AngularJSAPI
api means a PPLICATION&NBSP; < Span style= "font-size:12pt;" data-wiz-span= "Data-wiz-span" >p ROGRAMMING&NBSP; < Span style= "font-size:12pt;" data-wiz-span= "Data-wiz-span" >i nterface (Application Programming Interface).
AngularJS Global API
The AngularJS global API is used to perform common tasks for a set of JavaScript functions, such as:
-
- Compare objects
-
- Iterate objects
-
- Converting objects
Global API functions are accessed using the angular object.
Some common API functions are listed below:
API |
Description |
Angular.lowercase () |
Convert string to lowercase |
Angular.uppercase () |
Convert string to uppercase |
Angular.isstring () |
Determines whether the given object is a string, if true. |
Angular.isnumber () |
Determines whether the given object is a number, or true if it is returned. |
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>
Results: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>
Results: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.isString($scope.x1);
});
</script>
Results: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.isNumber($scope.x1);
-
- });
-
- </script>
Results:
"16" AngularJS API