Using Filters in AngularJS
Filters are used with expressions using following syntax :
{{ <data> | <filter>:<options> }}
currencyFormat number with currency symbol
{{ prd.price | currency }}
$20.67
date
Format date
{{ '11886576788965' | date:'dd/MM/yyyy hh:mma' }}
17/09/2015 02:30PM
upercase , lowercase
Change case
{{ 'hello sir' | uppercase }}
HELLO SIR
{{ 'Hello Sir' | lowercase }}
hello sir
limitTo
Extract substring based on limit provided
{{ 'Hello Sir' | limitTo:7 }}
Hello S
Iterate till number of items in array
<li ng-repeat="prd in c1.products | limitTo:5"
orderBy
Order the items in the list (Ascending order)
<li ng-repeat="prd in c1.products | orderBy:'price'"
Order the items in the list (Descending order)
<li ng-repeat="prd in c1.products | orderBy:'-price'"
No comments:
Post a Comment
Note: only a member of this blog may post a comment.