"16" AngularJS API

Source: Internet
Author: User


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 ()
  1. <div ng-app="myApp" ng-controller="myCtrl">
  2. <p>{{ x1 }}</p>
  3. <p>{{ x2 }}</p>
  4. </div>
  5. <script>
  6. var app = angular.module(‘myApp‘,[]);
  7. app.controller(‘myCtrl‘,function($scope){
  8. $scope.x1 ="JOHN";
  9. $scope.x2 = angular.lowercase($scope.x1);
  10. });
  11. </script>
Results:angular.uppercase ()

  1. <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 ()

  1. <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 ()
  1. <div ng-app="myApp" ng-controller="myCtrl">
  2. <p>{{ x1 }}</p>
  3. <p>{{ x2 }}</p>
  4. </div>
  5. <script>
  6. var app = angular.module(‘myApp‘,[]);
  7. app.controller(‘myCtrl‘,function($scope){
  8. $scope.x1 ="JOHN";
  9. $scope.x2 = angular.isNumber($scope.x1);
  10. });
  11. </script>
Results:




"16" AngularJS 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.