AngularJS API


API 意为 Application Programming Interface(应用程序编程接口)。


AngularJS 全局 API

AngularJS 全局 API 用于执行常见任务的 JavaScript 函数集合,如:

  • 比较对象
  • 迭代对象
  • 转换对象

全局 API 函数使用 angular 对象进行访问。

以下列出了一些通用的 API 函数:

API 描述
angular.lowercase() 转换字符串为小写
angular.uppercase() 转换字符串为大写
angular.isString() 判断给定的对象是否为字符串,如果是返回 true。
angular.isNumber() 判断给定的对象是否为数字,如果是返回 true。

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>
结果:

angular.uppercase()

  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.uppercase($scope.x1);
  10. });
  11. </script>
结果:

angular.isString()

  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.isString($scope.x1);
  10. });
  11. </script>
结果:

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>
结果:
 
 
 

【16】AngularJS API的更多相关文章

  1. 企业IT管理员IE11升级指南【16】—— 使用Compat Inspector快速定位IE兼容性问题

    企业IT管理员IE11升级指南 系列: [1]—— Internet Explorer 11增强保护模式 (EPM) 介绍 [2]—— Internet Explorer 11 对Adobe Flas ...

  2. LeetCode:字母异位词分组【16】

    LeetCode:字母异位词分组[16] 题目描述 给定一个字符串数组,将字母异位词组合在一起.字母异位词指字母相同,但排列不同的字符串. 示例: 输入: ["eat", &quo ...

  3. LeetCode:最接近的三数之和【16】

    LeetCode:最接近的三数之和[16] 题目描述 给定一个包括 n 个整数的数组 nums 和 一个目标值 target.找出 nums 中的三个整数,使得它们的和与 target 最接近.返回这 ...

  4. 【译】Android API 规范

    [译]Android API 规范 译者按: 修改R代码遇到Lint tool的报错,搜到了这篇文档,aosp仓库地址:Android API Guidelines. 58e9b5f Project ...

  5. 【VLC-Android】LibVLC API简介(相当于VLC的MediaPlayer)

    前言 学新东西API很重要,这里抛砖引玉整理了一下,欢迎反馈! 声明 欢迎转载,但请保留文章原始出处:)  博客园:http://www.cnblogs.com 农民伯伯: http://over14 ...

  6. 【转】vc api 录音

    一.数字音频基础知识 Fourier级数: 任何周期的波形可以分解成多个正弦波,这些正弦波的频率都是整数倍.级数中其他正线波的频率是基础频率的整数倍.基础频率称为一级谐波. PCM: pulse co ...

  7. 【转】Android API 中文(14) —— ViewStub

    用一个XML源填充view.inflate(上下文对象,资源文件Id,父窗口组一般为null): 原文网址:http://www.cnblogs.com/over140/archive/2010/10 ...

  8. CMDB服务器管理系统【s5day90】:API验证

    1.认证思路刨析过程 1.请求头去哪里拿? 1.服务器端代码: def test(request): print(request) return HttpResponse('你得到我了') 2.客户端 ...

  9. 【Web】Rest API 验证授权如何做?

    参考资料: [Web]Rest && 权限管理等:http://www.itdadao.com/2016/03/15/593144/ 无需OAuth就可以设计一个安全的REST (We ...

随机推荐

  1. .NET Runtime version 2.0.50727.8762 - 执行引擎错误(7969097A) (80131506)

    VS2010调试IIS发布的web工程提示:无法连接到 Visual Studio 开发服务器 .NET Runtime version 2.0.50727.8762 - 执行引擎错误(7969097 ...

  2. JAVA接口和抽象类的特点

    接口的特点: 1:接口不可实例化,可结合多态进行使用(接口 对象=new 对象()) 2:接口里的成员属性全部是以 public(公开).static(静态).final(最终) 修饰符修饰 3:接口 ...

  3. bzoj 1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐【dfs】

    从每个奶牛所在草场dfs,把沿途dfs到的草场的con都+1,最后符合条件的草场就是con==k的,扫一遍统计一下即可 #include<iostream> #include<cst ...

  4. [Swift]Array数组的swapAt函数

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  5. CentOS 7 配置 Nginx 正向代理 http、https 最详解

    手头项目中有使用到 nginx,因为使用的三方云服务器,想上外网需要购买外网IP的,可是有些需要用到外网却不常用的主机也挂个外网IP有点浪费了,便想使用nginx的反向代理来实现多台内网服务器使用一台 ...

  6. SimpleDataFormat详解

    [转]SimpleDateFormat使用详解 public class SimpleDateFormat extends DateFormat SimpleDateFormat 是一个以国别敏感的方 ...

  7. Java 8 (9) Optional取代null

    NullPointerException,大家应该都见过.这是Tony Hoare在设计ALGOL W语言时提出的null引用的想法,他的设计初衷是想通过编译器的自动检测机制,确保所有使用引用的地方都 ...

  8. python学习小结-字典key,val互换

    第一种,使用压缩器: >>> m = {'a': 1, 'b': 2, 'c': 3, 'd': 4} >>> zip(m.values(), m.keys()) ...

  9. Jmeter之JDBC请求参数化(二)

    二.上面已经讲了一些基本的配置,和简单的jdbc请求,下面来看下具体的如何将查询语句参数化. 参数化这里有几种方法,foreach,计数器,csv等,这里介绍几种方法.

  10. 设置vscode为中文

    设置vscode为中文 ctr+shift+p 输入 configure language 进 en更改为zh-cn , 重启vscode即可 , 如果还不行,就安装插件