AngularJS API

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>

相关文章
相关标签/搜索