API stands for Application Programming Interface.
The AngularJS Global API is a collection of global JavaScript functions used for common tasks such as:
These Global API functions are accessed via the angular
object.
Here are some commonly used API functions:
API |
Description |
angular.lowercase() |
Converts a string to lowercase. |
angular.uppercase() |
Transforms a string to uppercase. |
angular.isString() |
Returns true if the provided reference is a string. |
angular.isNumber() |
Returns true if the given reference is a number. |
<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> |
<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> |
<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> |
<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> |