标签:module dem string ext text ber iss [] put
AngularJS提供了如下的一下常用函数
API名称 | 描述 |
anguler.lowercase() | 转换为小写字母 |
anguler.uppercase() | 转换为大写字母 |
angular,.isString() | 是否为字符串 |
isNumber | 是否为数字 |
完整的一个例子:
<div ng-app="demo" ng-controller="mycontroller">
<input type="text" ng-model="inutStr"></input>
<p>input string is {{inpuStr}}</p>
<p>to lowercase is:{{lowercaseStr}}</p>
<p>to uppercase is:{{uppercaseStr}}</p>
<p ng-switch="isStr">is String:
<label ng-switch-when="true">yes</label>
<label ng-switch-when="false">No</label>
</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>
标签:module dem string ext text ber iss [] put
原文地址:http://www.cnblogs.com/VARForrest/p/7805580.html