1. Currency
The Currecy filter can format a numeric value as a currency format. Use {{123 | currency}} to convert 123 to currency format.
The Currecy filter allows us to set the currency symbol ourselves. The currency symbol for the region in which the client is located is used by default, but you can also customize the currency symbol.
{{currency}} <!--$1,000.00--
{{£ | currency: ' Rmb¥ '}} <!--rmb¥1,000.00--
2. Date
The date filter formats the dates into the format you want. Several date formats are built into the ANGULARJS, and if no format is specified, the default is Mediumdate format, which is shown in the example below.
The following is a built-in support for localized date formats:
{{Today | date: ' Medium '}} <!--, 12:09:02 PM--
{{Today | date: ' Short '} <!--8/9/1312:09pm--
{{Today | date: ' Fulldate '}} <!--Thursday, August,---
{{Today | date: ' Longdate '}} <!--August,---
{Today | date: ' mediumdate '}}<!--.
{{Today | date: ' shortdate '} <!--8/9/13--
{{Today | date: ' mediumtime '}}<!--12:09:02 PM--
{{Today | date: ' Shorttime '}} <!--12:09 PM--
Year formatting
Four-bit year: {{today | date: ' YYYY '}} <!--
Two-bit year: {{today | date: ' YY '}} <!--
One year: {{today | date: ' Y '}} <!--
Month formatting
English Month: {{today | date: ' MMMM '} <!--August--
Abbreviated English month: {today | date: ' MMM '} <!--
Number month: {{today |date: ' MM '} <!--
Month of the year: {{today |date: ' M '}} <!--8--
Date formatting
Numeric Date: {{today|date: ' DD '}} <!----
Day of the one month: {{today | date: ' d '}} <!--9--
English week: {today | date: ' EEEE '} <!--Thursday--
English week abbreviation: {today | date: ' EEE '} <!--Thu--
Hour formatting
24-hour Digital hours: {{today|date: ' HH '}} <!--00-->
Hours of the day: {{today|date: ' H '}} <!--0-->
12-hour Digital hours: {{today|date: ' hh '}} <!--12-->
Hours of the morning or afternoon: {{today|date: ' H '}} <!--12-->
Minute formatting
Number of minutes: {{Today | date: ' mm '} <!----
Minutes in one hours: {{Today | date: ' m '}} <!--9--
Number of seconds to format
Number of seconds: {{today | date: ' SS '}} <!--
Seconds in a minute: {{today | date: ' s '}} <!--2--
Milliseconds: {{today | date: '. SSS '}} <!--. 995--
Character formatting
Last Afternoon ID: {{today | date: ' A '}} <!--AM--
Four-bit time zone ID: {{today | date: ' Z '}} <!---0700--
Here are some examples of custom date formats:
{{Today | date: ' MMMD, y '}} <!--Aug9,---
{Today | date: ' eeee, D, M '}} <!--Thursday, 9, 8-->
{{Today | date: ' HH:MM:SS.SSS '} <!--12:09:02.995--
3.number
{{3.1415926 | number:1}} <!--3.1---
{{3.1415926 | number:2}} <!--3.14---
{{ -3.1415926 | number:2}} <!---3.14--
{{3 | number:2}} <!--3.00--
{{0.002 | number:2}} <!--0.00---
{{0.009 | number:2}} <!--0.01---
{{| number}} <!--
{{| #}} <!--
{{Number:2}} <!--1,000.00--
4.orderBy
{{[{name: ' Coolcao ', age:23},{name: ' Lily ', Age:20},{name: ' Tom ', age:22}] |
Results:
[{' name ': ' Lily ', ' age ': 20},{' name ': ' Tom ', ' Age ': 22},{' name ': ' Coolcao ', ' age ': 23}]
The default is in ascending order, if you want to reverse:
{{[{name: ' Coolcao ', age:23},{name: ' Lily ', Age:20},{name: ' Tom ', age:22}] | By: ' Age ': true}}
5.uppercase,lowercase
{' abc ' | uppercase} <!--ABC--
{' abc ' | lowercase} <!--ABC--
6.limitTo
The LimitTo filter is used to intercept an array or string and to receive a parameter that specifies the length of the Intercept.
{{Array | limitto:2}}
{{[' a ', ' B ', ' C ', ' d ', ' e ', ' F '] | limitto:1}} <!--["a"]--
7.json
JSON filters can convert a JSON or JavaScript object into a string.
{{"name": "Dreamapple", "Language": "AngularJS"} | json}}
Results:
{"Name": "Dreamapple", "Language": "AngularJS"}
AngularJS Built-in filter