Angular lets us use ‘filters’ to change the data.
To add a filter to change the data, we use the pipe symbol (|
). Notice the | uppercase
after the key
in the code below.
You can find a list of filters available on the AngularJS site here.
You can filter arrays and objects as well:
Filters really become cool when you use them with databinding. I can create a search on my page just by using a filter and then binding that data to the ng-repeat
variables:
You can use multiple filters on the same data. Notice the orderBy
filter: