The API is Application Programming Interface (Application interface).
ANGULARJS Global API
The ANGULARJS Global API is a set of global JavaScript functions for common operations such as:
- Comparison of two objects
- Iterate objects
- To convert data formats
Global API functions can be called directly by angular objects.
The following table columns include some of the more commonly used angular API functions:
API |
Description |
Angular.lowercase () |
Converts a string to lowercase. |
Angular.uppercase () |
Converts a string to uppercase. |
Angular.isstring () |
Determines whether the given object is a string. |
Angular.isnumber () |
Determines whether the given object is a number. |
Angular.lowercase ()
<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>
Run
Angular.uppercase ()
<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>
Run
Angular.isstring ()
<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>
Run
Angular.isnumber ()
<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>
Run
Previous chapter-Angularjs Quick Start Guide 14: Data validation Next chapter-Angularjs Quick Start Guide 16:bootstrap
Angularjs Quick Start Guide 15:api