From 303a68308157b507daaf6506d4c91cca8618cbc5 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 23 Nov 2010 16:28:24 -0800 Subject: docs for angular.Array.remove --- src/apis.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src') diff --git a/src/apis.js b/src/apis.js index e17447eb..cb2eaf43 100644 --- a/src/apis.js +++ b/src/apis.js @@ -46,6 +46,34 @@ var angularArray = { * @ngdoc function * @name angular.Array.indexOf * @function + * + * @description + * Determines the index of `value` in `array`. + * + * Note: this function is used to augment the Array type in angular expressions. See + * {@link angular.Array} for more info. + * + * @param {Array} array Array to search. + * @param {*} value Value to search for. + * @returns {number} The position of the element in `array`. The position is 0-based. `-1` is returned if the value can't be found. + * + * @example +
+
+ Index of '{{bookName}}' in the list {{books}} is {{books.$indexOf(bookName)}}. + + @scenario + it('should correctly calculate the initial index', function() { + expect(binding('books.$indexOf(bookName)')).toBe('2'); + }); + + it('should recalculate', function() { + input('bookName').enter('foo'); + expect(binding('books.$indexOf(bookName)')).toBe('-1'); + + input('bookName').enter('Moby Dick'); + expect(binding('books.$indexOf(bookName)')).toBe('0'); + }); */ 'indexOf': indexOf, 'sum':function(array, expression) { @@ -72,6 +100,9 @@ var angularArray = { * {@link angular.Array.indexOf indexOf} function on the `array` and only the first instance of * the element will be removed. * + * Note: this function is used to augment the Array type in angular expressions. See + * {@link angular.Array} for more info. + * * @param {Array} array Array from which an element should be removed. * @param {*} value Element to be removed. * @returns {*} The removed element. -- cgit v1.2.3