• AngularJS学习之全局API(应用程序编程接口)


    1.AngularJS全局API用于执行常见任务的Javascript函数集合:

    **比较对象

    **迭代对象

    **转换对象

    2.全局API函数使用angularJS对象进行访问:以下是通用API函数:

    **angular.lowercase():转换字符串为小写

    **angular.uppercase():转换字符串为大写

    **angular.isString():判断给定的对象是否为字符串,如果是返回true

    **angular.isNumber():判断给定的对象是否为数字,如果是返回true;

    3.实例:

    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>

    **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";

      $scopex2=angular.uppercase($scope.x1);

    });

    </script>

    **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>

    **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>

  • 相关阅读:
    C++/CLI中的资源清理(Destructor,Finalizer
    c++/cli 之数据库操作
    利用139,189,yahoo等邮箱短信提示来免费发短信提示
    小例子复习下委托的应用
    c++/cli 之日志记录
    c++/cli 之异步Socket完成端口实例
    C++/CLI, Finalize and Dispose
    C/C++的位运算符操作
    实现自定义控件与背景图完全重叠
    RichTextBox与NotifyIcon简单模仿QQ效果
  • 原文地址:https://www.cnblogs.com/hqutcy/p/6109656.html
Copyright © 2020-2023  润新知