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>