过滤器可以使用一个管道字符(|)添加到表达式和指令中。
angularjs中提供了如下几种过滤器:
过滤器
描述
filter
从数组项中选择一个子集
currency
格式化数字为货币格式
number
格式化数字为文本
date
格式化日期为指定格式字符串
json
允许将js对象转换为json字符串
lowercase
格式化字符串为小写
uppercase
格式化字符串为大写
limitto
从数组或字符串项中选择制定长度的一个子集
orderby
根据某个表达式排列数组
运行效果:
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器 下面我们来实现一个字符串反转的过滤器。
AngularJS 过滤器filtercurrencynumberdatejsonlowercase和uppercaselimitToorderBy自定义过滤器