Angularjs Quick Start Guide 15:api

Source: Internet
Author: User



The API is Application Programming Interface (Application interface).


ANGULARJS Global API


The ANGULARJS Global API is a set of global JavaScript functions for common operations such as:


    • Comparison of two objects
    • Iterate objects
    • To convert data formats


Global API functions can be called directly by angular objects.



The following table columns include some of the more commonly used angular API functions:


API Description
Angular.lowercase () Converts a string to lowercase.
Angular.uppercase () Converts a string to uppercase.
Angular.isstring () Determines whether the given object is a string.
Angular.isnumber () Determines whether the given object is a number.
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>


Run


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>


Run


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.uppercase($scope.x1);
}); </script>


Run


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.isString($scope.x1);
}); </script>


Run


Previous chapter-Angularjs Quick Start Guide 14: Data validation Next chapter-Angularjs Quick Start Guide 16:bootstrap





Angularjs Quick Start Guide 15:api


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.