Improve this Doc View Source orderBy
- filter in module ng
Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted correctly, make sure they are actually being saved as numbers and not strings.
Usage
In HTML Template Binding
{{ orderBy_expression | orderBy : expression : reverse}} In JavaScript
$filter('orderBy')(array, expression, reverse) Arguments
| Param | Type | Details | 
|---|---|---|
| array | Array | The array to sort. | 
| expression | function(*)stringArray.<(function(*)|string)>= | A predicate to be used by the comparator to determine the order of elements. Can be one of: 
 | 
| reverse (optional) | boolean | Reverse the order of the array. | 
Returns
| Array | Sorted copy of the source array. | 
It's also possible to call the orderBy filter manually, by injecting $filter, retrieving the filter routine with $filter('orderBy'), and calling the returned filter routine with the desired parameters.
Example:
    © 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
    https://code.angularjs.org/1.2.32/docs/api/ng/filter/orderBy