# `orderBy` (filter in module `ng` )

Improve this doc

## Description

Orders a specified `array` by the `expression` predicate.

Note: this function is used to augment the `Array` type in Angular expressions. See `ng.$filter` for more information about Angular arrays.

## Usage

    filter:orderBy(array, expression[, reverse]);

### Parameters

- `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`: Getter function. The result of this function will be sorted using the `<`, `=`, `>` operator.
  - `string`: An 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 (for example, +name or -name).
  - `Array`: An array of function or string predicates. The first predicate in the array is used for sorting, but when two items are equivalent, the next predicate is used.
- `reverse(optional) – {boolean=} –`

  Reverse the order the array.

### Returns

`{Array}` –

Sorted copy of the source array.

## Example

#### Source

#### Demo