The orderBy filter sorts the array using an expression.
The orderBy function takes two parameters. First one is required, the second is optional.
The first parameter is the predicate used to determine the order. It can be
The second parameter controls the sort order of the array: reversed or not.
To sort an array of objects by their name
{{ [{ 'name': 'A', 'status': 'ok' }, { 'name': 'Q', 'status': 'notOK' }, { 'name': 'Z', 'status': 'ok' }] | orderBy: 'name' }}
To reverse-sort the object, add the second parameter as true:
{{ [{ 'name': 'A', 'status': 'ok' }, { 'name': 'Q', 'status': 'notOK' }, { 'name': 'Z', 'status': 'ok' }] | orderBy: 'name':true }}