Angular JS Filter notes (go from rookie tutorial)

Source: Internet
Author: User

1. Uppercase,lowercase Case Conversion

{{' lower cap string '|}} //Result: LOWER CAP STRING{{"TANK is good"|}} //Result: Tank is good        

2. Date format

{{1490161945000| date:"Yyyy-mm-dd HH:mm:ss"}}//2017-03-22 13:52:25   

3, number formatting (keep decimals)

{{149016.1945000| number:2}}     

4. Currency Currency format

{{]|}} //Result: $250.00{{] | currency:"Rmb¥"}}//Result: rmb¥250.00  

5. Filter Lookup

Input filters can be added to the directive with a pipe character (|) and a filter followed by a colon and a model name.

Filter filter Select a subset from the array

 Find the line name for the iphone{{ [{"Age": 20,"id": 10,"Name": "iphone"},{"Age": 12,"id": 11, "name" :  "Sunm Xing" },{ "age" :< Span class= "PLN" > 44, "id" :  12, "name" :   "test abc" } | Filter:{ ' name ' : ' iphone ' } }}     

6, LimitTo interception

{{"1234567890"|:6}}//6-bit {"1234567890" from the front ({"*") | limitto:4 }}//Starting from the back to intercept 4 bits             

7. Sort by order

 Root ID Descending row{{ [{"Age": 20,"id": 10,"Name": "iphone"},{"Age": 12,"id": 11,"Name": "Sunm Xing"},{"Age": 44,"id": 12,"Name": "Test ABC"}] |By:' ID ':True }}Ascending row by ID{{ [{"Age": 20,"id": 10,"Name": "iphone"},{"Age": 12, "id" : 11 "name" :  "SUNM Xing" },< Span class= "PLN" >{ "age" :  44, "id" : 12 , "name" :  "test ABC" Span class= "pun" >}] | Orderby: ' ID '  }}      

Angular JS Filter notes (go to rookie tutorial)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.