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. 使用WinSXS进行系统盘瘦身Windows 7/2008/10/2012不断变大的C盘(Windows 更新清理)

    这是一款非常给力的国产良心小工具,用阿里云ECS的时候,一个C盘没多久就被坑爹的微软更新沉余文件塞满.此工具简单好用一下搞定! 操作系统: 所有 NT 6.X 内核的操作系统.比如 Windows V ...

  2. 4-3 买家类目-service

    DAO:ProductCategory.Service可以简化一些,叫CategoryService. package com.imooc.sell.service; import com.imooc ...

  3. mldonkey设置!看图(转载)

    转自:http://www.nenew.net/ubuntu-mldonkey-application.html 这里不是争论区,amule和mldonkey各有各好,看个人爱好,没有高下,都是程序员 ...

  4. mysql之distinct

    记录一下这几天看mysql必知必会的小知识点: 关于mysql查询不同的行 比如记录表中 查询有多少个城市 可能查出很多城市 可以用distinct 来解决这个问题 SELECT DISTINCT c ...

  5. 洛谷 P1414 又是毕业季II(未完成)

    题目背景 “叮铃铃铃”,随着高考最后一科结考铃声的敲响,三年青春时光顿时凝固于此刻.毕业的欣喜怎敌那离别的不舍,憧憬着未来仍毋忘逝去的歌.1000多个日夜的欢笑和泪水,全凝聚在毕业晚会上,相信,这一定 ...

  6. [C陷阱和缺陷] 第1章 词法“陷阱”

    有感自己的C语言在有些地方存在误区,所以重新仔细把"C陷阱和缺陷"翻出来看看,并写下这篇博客,用于读书总结以及日后方便自身复习. 第1章 词法"陷阱" 1.1 ...

  7. php 5.6 版本配置 oracle ddl

    1. Windows版PHP内置了Oracle驱动,在ext目录下:php_oci8.dllphp_oci8_11g.dllphp_pdo_oci.dllLinux上如果自己编译的话则添加下面的con ...

  8. 【转】rpm包和源码包安装的区别

    转自:https://blog.csdn.net/junjie_6/article/details/59483785 建议在安装线上的生产服务器软件包时都用源码安装,这是因为源码安装可以自行调整编译参 ...

  9. Spring-Aop的两种代理方式

    Spring-Aop两种代理方式: 1.JDK动态代理:用于目标类实现了接口: 2.Cglib动态代理:用于目标类没有实现接口: spring会依据目标类是否实现接口来选择使用哪种代理方式(目标类:相 ...

  10. (2)左右值初探与auto类型说明符

    这篇文章的起因是下面这两段代码,出自<C++ primer 5th>中文版P62页: auto &h =42;//错误,不能为非常量引用绑定字面值 const auto & ...