AngularJs provides great filtering options. We use the filter for filtering the collection of data according to user selection.
Following code filter the students’ data using the user entry in ‘query’ field. In this case the filter will apply to all fields in students’ data collection.
Search: <input ng-model=”query” />
<ul>
<li ng-repeat=”st in students | filter:query“>
<p></p>
</li>
</ul>
Angular provides specific field level filtering. Following sample displays the students whose status is ‘Pass’
<ul>
<li ng-repeat=”st in students | filter:{Status: ‘Pass’} “>
<p></p>
</li>
</ul>
Moreover, we can perform multiple filtering in the same collection. Following sample shows how we can filter the students whose status is ‘Pass’ using user input
Search: <input ng-model=”query” />
<ul>
<li ng-repeat=”st in students | filter:{Status: ‘Pass’}| filter:query “>
<p></p>
</li>
</ul>