AngularJS API
As we knows that API stand for Application Programming Interface. Now we read something about AngularJS Global API. We use AngularJS Global API to perform common tasks like we do with global JavaScript functions as given below:-
(1)Comparing Objects
(2)Iterating Objects
(3)Converting Data
We can access Global API functions by using angular object. Below are the list of some common API functions:-
(1)angular.lowercase():- Here we will convert string into lowercase
(2)angular.uppercase():- Here we will convert string into uppercase
(3)angular.isString():- This will return true if the reference is string
(4)angular.isNumber():- this will return true if the reference is a number
Below we use 4 above API Function:-
(1)angular.lowercase()
var app = angular.module('myTestApp', []);
app.controller('myTestCtrl', function($scope) {
$scope.x1 = "ADAM SUTRO";
$scope.x2 = angular.lowercase($scope.x1);
});
(2)angular.uppercase()
var app = angular.module('myTestApp', []);
app.controller('myTestCtrl', function($scope) {
$scope.x1 = "adam sutro";
$scope.x2 = angular.uppercase($scope.x1);
});
(3)angular.isString()
var app = angular.module('myTestApp', []);
app.controller('myTestCtrl', function($scope) {
$scope.x1 = "ADAM SUTRO";
$scope.x2 = angular.isString($scope.x1);
});
(4)angular.isNumber()
var app = angular.module('myTestApp', []);
app.controller('myTestCtrl', function($scope) {
$scope.x1 = "ADAM";
$scope.x2 = angular.isNumber($scope.x1);
}); | |