AngularJS提供了以下的一下經常使用函數app
API名稱 | 描述 |
anguler.lowercase() | 轉換爲小寫字母 |
anguler.uppercase() | 轉換爲大寫字母 |
angular,.isString() | 是否爲字符串 |
isNumber | 是否爲數字 |
完整的一個例子:函數
<div ng-app="demo" ng-controller="mycontroller">ip
<input type="text" ng-model="inutStr"></input>字符串
<p>input string is {{inpuStr}}</p>input
<p>to lowercase is:{{lowercaseStr}}</p>string
<p>to uppercase is:{{uppercaseStr}}</p>it
<p ng-switch="isStr">is String:io
<label ng-switch-when="true">yes</label>table
<label ng-switch-when="false">No</label>function
</p>
<p ng-switch="isNum">is Number:
<label ng-switch-when="true">yes</label>
<label ng-switch-when="false">No</label>
</p>
</div>
<script>
var app=angular.module("demo",[]);
app.controller("mycontroller",function($scope){
$scope.lowercaseStr=angular.lowercase($scope.inputStr);
$scope.uppercaseStr=angular.uppercase($scope.inputstr);
$scope.isStr=angular.isString($scope.input);
//$scope.isNum=angualr.isnum($scope.input);
});
</script>