Hi all,
In angularJs filters are use to change and modify the data. We can use multi filter using pipe (|).
Below is some example of filters-
1) uppercase
2) lowercase
3) currency
4) filter
5) orderby
Uppercase :-
Uppercase filter is use to make all letters capital.
<input type="text" ng-model="student.lastName">
Name : {{student.fullName() | uppercase}}
Lowercase :-
Lowercase filter is use to make all letters small.
<input type="text" ng-model="student.lastName">
Name : {{student.fullName() | lowercase}}
Currency:-
This filter is use to format currency.
<input type="text" ng-model="student.lastName">
Amount : {{student.fullName() | lowercase}}
Filter :-
It is use to filter any particular thing, for example-
<input type="text" ng-model="subjectName">
<ul>
<li ng-repeat="subject in student.subjects | filter: subjectName">
{{ subject.name + ', marks:' + subject.marks }}
</li>
</ul>
In this example we have two thing one is subject name and second is subject mark, but list will filter with subject name recourse we are filter only subject name.
Orderby:-
This filter also plays an important role in filtering. We can sort a data list with it.
Eg-
<ul>
<li ng-repeat="subject in student.subjects | orderBy:'marks'">
{{ subject.name + ', marks:' + subject.marks }}
</li>
</ul>
Hence, we have filter list order by marks
0 Comment(s)