AngularJS API

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

2、AngularJS全局API用于执行常见的Javascript函数集合,如:

比较对象

转换对象

迭代对象

3、全局API函数使用AngularJS对象进行访问。

4、下面列出了一些通用的API函数

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

 

 

 

 

 

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible"content="IE=edge" />
<meta name="viewport"content="width=device-width,initial-scale=1" />
<!--[if lt IE 9]>
<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.js"></script>
<![endif]-->
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet"href="bootstrap-3.3.6-dist/css/bootstrap.min.css" />
</head>
<body>
<div class="container"style="padding:50px">
<div data-ng-app="myApp"data-ng-controller="myCtrl">
<p>{{x1}}</p>
<p>{{x2}}</p>
<p>{{x3}}</p>
<p>{{x4}}</p>
<p>{{x5}}</p>
<p>{{x6}}</p>
<p>{{x7}}</p>
<p>{{x8}}</p>
</div>
</div>
<script src="jQuery/jquery-2.1.4.min.js"></script>
<script src="bootstrap-3.3.6-dist/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
//angular.module("myApp", []).controller("myCtrl", function ($scope) { $scope.x1 = "AngularJS";$scope.x2=angular.lowercase($scope.x1) })
angular.module("myApp", []).controller("myCtrl", function ($scope) { $scope.x1 = "AngularJS"; $scope.x2 = angular.lowercase($scope.x1); $scope.x3 = angular.uppercase($scope.x1); $scope.x4 = angular.isString($scope.x1); $scope.x5 = angular.isNumber($scope.x1); $scope.x6 = angular.isArray($scope.x1); $scope.x7 = angular.isDate($scope.x1);$scope.x8=angular.isObject($scope.x1)})
</script>
</body>
</html>

posted @ 2015-12-21 17:02  melao2006  阅读(192)  评论(0编辑  收藏  举报