1, uppercase, lowercase case conversion
{{ "lower cap string" | uppercase }} // 结果:LOWER CAP STRING
{{ "TANK is GOOD" | lowercase }} // 结果:tank is good
2, date formatting
{{1490161945000 | date:"yyyy-MM-dd HH:mm:ss"}} // 2017-03-22 13:52:25
3, number formatting (retain decimals)
{{149016.1945000 | number:2}}
4. currency currency formatting
{{ 250 | currency }} // result: $250.00
{{ 250 | currency:"RMB ¥ " }} // Result: RMB ¥ 250.00
5, filter search
Input filters can be added to directives by a pipe character (|) followed by a filter followed by a colon and a model name.
filter filter selects a subset from an array
// find the row with the name iphone
{{ [{"age": 20,"id": 10,"name": "iphone"},
{"age": 12,"id": 11,"name": "sunm xing"},
{"age": 44,"id": 12,"name": "test abc"}
] | filter:{'name':'iphone'} }}
6, limitTo interception
{{"1234567890" | limitTo :6}} // intercept 6 digits from the front
{{"1234567890" | limitTo:-4}} // intercept 4 digits from the back
7. orderBy sorting
// Sort by root id in descending order
{{ [{"age": 20,"id": 10,"name": "iphone"},
{"age": 12,"id": 11,"name": "sunm xing"},
{"age": 44,"id": 12,"name": "test abc"}
] | orderBy:'id':true }}
// sort by id in ascending order
{{ [{"age": 20,"id": 10,"name": "iphone"},
{"age": 12,"id": 11,"name": "sunm xing"},
{"age": 44,"id": 12,"name": "test abc"}
] | orderBy:'id' }}