What are the AngularJs Global API?

Global API in AngularJS
API stands for Application Programming Interface. It is a set of protocols, routine and tools for building software application which allows the user to interact with the application and perform the several tasks.
In AngularJS Global API is a set of global Javascript functions used for performing tasks like comparing objects, iterating object, converting data.
Some API functions in AngularJS is shown below:
- angular.lowercase: This converts the string into lowercase.
Syntax:
angular.lowercase(string);
Example 1:
<html><script src=</script><body><div ng-app="App"ng-controller="Ctrl"><p>{{"Before Conversion: "+ i1 }}</p><p>{{"After Conversion: "+ i2 }}</p></div><script>varapp = angular.module('App', []);app.controller('Ctrl',function($scope) {$scope.i1 ="GeeksforGeeks";// converting string into lowercase$scope.i2 = angular.lowercase($scope.i1);});</script></body></html>chevron_rightfilter_noneOutput:
Before Conversion: GeeksforGeeks After Conversion: geeksforgeeks
- angular.uppercase: This converts the string into uppercase.
Syntax:
angular.uppercase(string);
Example 2:
<html><script src=</script><body><div ng-app="App"ng-controller="Ctrl"><p>{{"Before Conversion: "+ i1 }}</p><p>{{"After Conversion: "+ i2 }}</p></div><script>varapp = angular.module('App', []);app.controller('Ctrl',function($scope) {$scope.i1 ="geeksforGeeks";// converting string into uppercase$scope.i2 = angular.uppercase($scope.i1);});</script></body></html>chevron_rightfilter_noneOutput:
Before Conversion: geeksforgeeks After Conversion: GEEKSFORGEEKS
- angular.isString: This check the given value is a string or not, if the value is string then it returns true else it returns false.
Syntax:
angular.isString(value);
Example
<html><script src=</script><body><div ng-app="App"ng-controller="Ctrl"><p>{{"Value is: "+ i1 }}</p><p>{{"Value is string: "+ i2 }}</p></div><script>varapp = angular.module('App', []);app.controller('Ctrl',function($scope) {$scope.i1 = 15;// checks whether the given value is a string$scope.i2 = angular.isString($scope.i1);});</script></body></html>chevron_rightfilter_noneOutput:
Value is: 15 Value is String: false
- angular.isNumber: This checks whether the given value is number or not, if it is a number then it returns true else it returns false.
Syntax:
angular.isNumber(value);
Example
<html><script src=</script><body><div ng-app="App"ng-controller="Ctrl"><p>{{"Value is: "+ i1 }}</p><p>{{"Value is string: "+ i2 }}</p></div><script>varapp = angular.module('App', []);app.controller('Ctrl',function($scope) {$scope.i1 = 15;// checks whether the given value is a number$scope.i2 = angular.isNumber($scope.i1);});</script></body></html>chevron_rightfilter_noneOutput:
Value is: 15 Value is Number: true
- angular.isDate: This checks whether the given value is date or not
- angular.isArray: This checks whether the given reference is array or not
- angular.isFunction: This checks whether the given reference is function or not
- angular.isObject: This checks whether the given reference is a object or not
Some more APIs in AngularJS are given below:
Recommended Posts:
- How to declare a global variable in PHP?
- JavaScript | global Property
- Global keyword in Python
- What is the Python Global Interpreter Lock (GIL)
- Global and Local variables in JavaScript
- How to change the value of a global variable inside of a function using JavaScript ?
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- AngularJS | API
- AngularJS | Directive
- AngularJS | Modules
- AngularJS | Controllers
- AngularJS | Includes
- AngularJS | ng-jq Directive
- AngularJS | Filters
- AngularJS | Routing
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


