$filter

在js中使用$filter来调用过滤器

  <script type="text/javascript">
var app = angular.module('myApp', []);
app.controller('MyController', function($scope, $filter) {
	$scope.name = $filter('lowercase')('Ari');
	
});
</script>

 AngularJS提供的内置过滤器
1.currency
可以将一个数值格式化为货币格式
2.date
可以将日期格式需要的格式
3.filter
可以从给定的数组中选择一个子集,并生成一个新数据返回
4.json
可以将一个JSON或JavaScript对象转换成字符串
5.limitTo
根据传入的参数生成一个新的数组或字符串,新的数组或字符串的长度取决于传入的参数
6.lowercase
将字符串转换为小写
7.number
将数字格式化成文本
8.orderBy
可以用表达式对指定的数组进行排序
9.uppercase
将字符串转换为大写

猜你喜欢

转载自liuna718-163-com.iteye.com/blog/2302196