From b7aff92354a718c140c149945c5a78a98d61baa6 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 24 Nov 2010 22:33:40 -0800 Subject: docs for angular.bind --- src/Angular.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index 6347795e..658f6ae2 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1025,6 +1025,23 @@ function concat(array1, array2, index) { return array1.concat(slice.call(array2, index, array2.length)); } + +/** + * @workInProgress + * @ngdoc function + * @name angular.bind + * @function + * + * @description + * Returns function which calls function `fn` bound to `self` (`self` becomes the `this` for `fn`). + * Optional `args` can be supplied which are prebound to the function, also known as + * [function currying](http://en.wikipedia.org/wiki/Currying). + * + * @param {Object} self Context in which `fn` should be evaluated in. + * @param {function()} fn Function to be bound. + * @param {(...*)=} args Optional arguments to be prebound to the `fn` function call. + * @returns {function()} Function that wraps the `fn` with all the specified bindings. + */ function bind(self, fn) { var curryArgs = arguments.length > 2 ? slice.call(arguments, 2, arguments.length) : []; if (typeof fn == $function) { @@ -1034,7 +1051,7 @@ function bind(self, fn) { return arguments.length ? fn.apply(self, arguments) : fn.call(self); }; } else { - // in IE, native methods ore not functions and so they can not be bound (but they don't need to be) + // in IE, native methods are not functions and so they can not be bound (but they don't need to be) return fn; } } -- cgit v1.2.3