Orders array
by the expression
predicate.
Note: this function is used to augment the Array
type in angular expressions. See
angular.Array
for more info.
angular.Array.orderBy(array, expression[, reverse]);
array – {Array} –
The array to sort.
expression – {function(*, *)|string|Array.<(function(*, *)|string)>} –
A predicate to be used by the comparator to determine the order of elements.
Can be one of:
function
: JavaScript's Array#sort comparator functionstring
: angular expression which evaluates to an object to order by, such as 'name' to
sort by a property called 'name'. Optionally prefixed with +
or -
to control ascending
or descending sort order (e.g. +name or -name).Array
: array of function or string predicates, such that a first predicate in the array
is used for sorting, but when the items are equivalent next predicate is used.reverse(optional) – {boolean} –
Reverse the order the array.
{Array}
– Sorted copy of the source array.