diff options
| author | Igor Minar | 2010-11-24 22:33:40 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-24 22:33:40 -0800 |
| commit | b7aff92354a718c140c149945c5a78a98d61baa6 (patch) | |
| tree | 63d05b159e705f31f2fe4358aa410fdecd56aae3 | |
| parent | 6b3b00e0953176598df2981191bb8264c435ab50 (diff) | |
| download | angular.js-b7aff92354a718c140c149945c5a78a98d61baa6.tar.bz2 | |
docs for angular.bind
| -rw-r--r-- | src/Angular.js | 19 |
1 files changed, 18 insertions, 1 deletions
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; } } |
