“`”

ng 内置的 filter 有九种:
date(日期)
currency(货币)
limitTo(限制数组或字符串长度)
orderBy(排序)
lowercase(小写)
uppercase(大写)
number(格式化数字,加上千位分隔符,并接收参数限定小数点位数)
json(格式化 json 对象)
filter(处理一个数组,过滤出含有某个子串的元素)
filter有两种使用方法,一种是直接在页面里:

{{now | date : 'yyyy一MM一dd'}}

1
另一种是在 js 里面用:
// filter(‘过滤器名称’)(需要过滤的对象, 参数1, 参数2,…)filter(‘date’)(now, ‘yyyy一MM一dd hh:mm:ss’);

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.