Built in filters

Angular ships with some handy filters you can use for basic sorting and filtering.


<p ng-repeat="person in test.people | orderBy:'name'">

This filter sorts the collection by the name field. -name will reverse the order.


<p ng-repeat="person in test.people | limitTo:5">

This filter returns only the first 5 results. -5 will return only the last 5 results.

Chaining filters

The pipe operator allows filters to be stacked and evaluated sequentially on the results of the previous collection filter.

<p ng-repeat="person in test.people | filter:search | orderBy:'name'  | limitTo: 5">

This filter will filter the entire collection against the search model, order the matched results by the name attribute, and limit the result set to 5 entries.

Model data can be treated as a filterable collection as well.