AngularJS API
API means Application Programming Interface.
AngularJS Global API
AngularJS global API is a collection of JavaScript functions used to perform common tasks, such as:
Comparison object
Iterative objects
Convert object
Global API functions are accessed using angular objects.
Here are some common API functions:
| API | describe |
|---|---|
| angular.lowercase() | Convert string to lowercase |
| angular.uppercase() | Convert string to uppercase |
| angular.isString() | Determines whether the given object is a string, and returns true if it is. |
| angular.isNumber() | Determines whether the given object is a number, and returns true if it is. |
angular.lowercase()
<!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.lowercase($scope.x1);});</script></body></html>Running results:
JOHN
john
angular.uppercase()
<!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>Running results:
JOHN
true
angular.isString()
<!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>Running results:
JOHN
true
angular.isNumber()
<!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>Running results:
JOHN
false
The above is a compilation of AngularJS API (interface) data, and will be supplemented later. I hope that students who can help with programming.