The API (interface) in Angularjs is simple to implement _ANGULARJS

Source: Internet
Author: User
Tags lowercase

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.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.