AngularJS API
API means Application Programming Interface (Application Programming Interface).
AngularJS Global API
AngularJS Global API A collection of JavaScript functions used to perform common tasks, such as:
Compare objects
Iterate object
Convert object
Global API functions are accessed using angular objects.
Some common API functions are listed below:
API | Description |
---|---|
angular.lowercase() | Convert the string to lowercase |
angular.uppercase() | Convert the string to uppercase |
angular.isString() | Determine whether the given object is a string, and return true if so. |
angular.isNumber() | Determine whether the given object is a number, and return true if so. |
angular.lowercase()
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="//cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.lowercase($scope.x1); }); </script> </body> </html>
Run Example»
Click the "Run Example" button to view the online example
angular.uppercase()
Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "John"; $scope.x2 = angular.uppercase($scope.x1); }); </script> </body> </html>
Run instance»
Click the "Run instance" button to view the online instance
angular.isString()
Example
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.isString($scope.x1); }); </script> </body> </html>
Run instance»
Click the "Run instance" button to view the online instance
angular.isNumber()
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.isNumber($scope.x1); }); </script> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance