AngularJS API
API means Application Programming Interface (application programming interface).
AngularJS global API
The AngularJS global API is a collection of JavaScript functions used to perform common tasks, such as:
Compare objects
Iterate object
Conversion object
Global API functions are accessed using angular objects.
Some common API functions are listed below:
API description
angular.lowercase () convert string to lower case
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>
operation result:
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>
operation result:
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>
operation result:
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>
operation result:
JOHN
false
The above is the collation of AngularJS API (interface) materials, which will continue to be added later, hoping to help students who are programming.