From 870547d185ce755d695cc75d908c1deb78d89f49 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 23 Nov 2010 15:44:14 -0800 Subject: docs for angular.Array.orderBy --- src/apis.js | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'src/apis.js') diff --git a/src/apis.js b/src/apis.js index b77161fb..e39c7c04 100644 --- a/src/apis.js +++ b/src/apis.js @@ -295,7 +295,79 @@ var angularArray = { * @ngdoc function * @name angular.Array.orderBy * @function + * + * @description + * Orders `array` by the `expression` predicate. + * + * Note: this function is used to augment the Array type in angular expressions. See + * {@link angular.Array} for more info. + * + * @param {Array} array The array to sort. + * @param {function()|string|Array.<(function()|string)>} expression A predicate to be used by the + * comparator to determine the order of elements. + * + * Can be one of: + * + * - `function`: JavaScript's Array#sort comparator function + * - `string`: 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. + * + * @param {boolean=} descend TODO + * @returns {Array} Sorted copy of the source array. + * + * @example +
+ +Sorting predicate = {{predicate}}
+ | Name + (^) | +Phone + (^) | +Age + (^) | +
|---|---|---|
| {{friend.name}} | +{{friend.phone}} | +{{friend.age}} | +