In our development often need to display on the page to the user's information needs to be processed format, can be displayed to the user. In the ANGULARJS to provide us with the order called filter, so that we can easily do some of the functions of the column, Angularjs inside for us to provide a number of many built-in filter.
Today, let's take a look at Angularjs's built-in filters.
Let's take a look at these built-in filter usage methods:
A filter with no parameters
{{expression | filter}}
A filter, with parameters of the case
{{expression | filter:arguments}}
A filter, with multiple parameters of the case
{{expression | filter:arg1:arg2: ...}}
Multiple filters with no parameters
{{expression | filter1 | filter2 | ...}}
Below we use the following ANGULARJS built-in filters
Currency
Currency allows us to set our own currency symbol, which by default takes the currency symbol of the area where the client is placed.
You can use this: {{3600 | currency: ' $¥ '}}
Returns the result to $¥123.00
Online Code click Preview
Number
Number filter formats numbers as text, and its arguments are optional to control the number of bits intercepted after the decimal point
If a non-numeric character is passed in, an empty string is returned
You can use this: {{3600 | number:2}}
The result returned is: 3,600.00
Online Code click Preview
lowercase
Lowercase converts a string to lowercase
You can use this: {{' HEllo ' | lowercase}}}
Returns the result: Hello
Online Code click Preview
Uppercase
Uppercase converts a string to uppercase
You can use this: {{' HEllo ' | uppercase}}}
Returns the result: HELLO
Online Code click Preview
Json
The JSON filter converts a JSON or JavaScript object to a string.
This filter is quite useful for debugging
You can use this: {{{} ' name ': ' Dreamapple ', ' language ': ' Angularjs '} | json}}
The result returned is: {"name": "Dreamapple", "Language": "Angularjs"}
Online Code click Preview
Date
The date filter filters the dates into the format you want, which is a really good filter.
This filter uses a lot of me here to enumerate several commonly used
{{Today | date: ' YYYY-MM-DD '}}
The result is: 2015-15-13
{{Today | date: ' YYYY-MM-DD hh:mm::ss '}}
Results: 2015-18-13 20:18::38
[Online Code] (2015-18-13 20:18::38)
There are three built-in filters, but using a little more complexity, put it in the next article.
The above mentioned is the entire content of this article, I hope you can enjoy.