参考地址
<!-- uppercase 转换为大写 -->
{{ 'true | false' | uppercase }} <br> <!-- TRUE | FALSE -->
<!-- lowercase 转换为小写 -->
{{ 'TRue | FalsE' | lowercase }} <br> <!-- true | false -->
<!-- currency 格式化数字为货币格式(https://docs.angularjs.org/api/ng/filter/currency) -->
{{ 2332.32 | currency }} <br> <!-- $2,332.32 -->
{{ 2332.32 | currency:'¥ ' }} <br> <!-- ¥ 2,332.32 -->
{{ 2332.32 | currency:'¥ ':1 }} <br> <!-- ¥ 2,332.32 -->
<!-- date 日期转换 [date](https://docs.angularjs.org/api/ng/filter/date) -->
{{ 0 | date }} <br> <!-- Jan 1, 1970 -->
{{ 0 | date:'yyyy-MM-dd HH:mm:ss' }}<br> <!-- 1970-01-01 08:00:00 -->
{{ 0 | date:'yy-MM-dd HH:mm:ss' }} <br> <!-- 70-01-01 08:00:00 -->
<!-- limitTo 现在字符串输出长度 -->
{{ '@ True | False' | limitTo:4 }} <br> <!-- @ Tr -->
{{ '@ True | False' | limitTo:-4 }} <br> <!-- alse -->
{{ '艾特@ True | False' | limitTo:5 }} <br> <!-- 艾特@ T -->
<!-- json 【用于调试】,将javascript对象转换为json字符串 -->
{{ {'ad':'wd','ed':'asd'} | json:4 }} <br> <!-- 后面4表示缩进的空格数 -->
<!-- number 格式化数字类型 -->
{{ 123.123 | number:2 }} <br> <!-- 123.12 -->
{{ 123.123 | number:0 }} <br> <!-- 123 -->
<!-- orderBy 排序默认asc -->
{{ [{"age": 20,"id": 10,"name": "iphone"},{"age": 12,"id": 11,"name": "sunm xing"},{"age":44,"id": 12,"name": "test abc"}] | orderBy:'id':true }} <br>
<!-- 上、根据id字段降序(DESC)排序。(省略true默认ASE升序排序) -->
{{ [{"age": 20,"id": 10,"name": "iphone"},{"age": 12,"id": 11,"name": "sunm xing"},{"age":44,"id": 12,"name": "test abc"}] | orderBy:'-id' }}
<!-- 上、在怕徐字段处添加负号;表示降序(DESC)排序 -->
<!-- filter 查找(从数组中选择一个子集)(https://docs.angularjs.org/api/ng/filter/filter) -->
{{ [{"age": 20,"id": 10,"name": "iphone"},{"age": 12,"id": 11,"name": "sunm xing"},{"age": 44,"id": 12,"name": "test abc"}] | filter:{'name':'iphone',age:''} }}
网友评论