MCPcopy
hub / github.com/angular-ui/ui-router / bind

Function bind

test/angular/1.7/angular.js:1379–1397  ·  view source on GitHub ↗

* @ngdoc function * @name angular.bind * @module ng * @kind function * * @description * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for * `fn`). You can supply optional `args` that are prebound to the function. This feature is also * known as [part

(self, fn)

Source from the content-addressed store, hash-verified

1377 * @returns {function()} Function that wraps the `fn` with all the specified bindings.
1378 */
1379function bind(self, fn) {
1380 var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
1381 if (isFunction(fn) && !(fn instanceof RegExp)) {
1382 return curryArgs.length
1383 ? function() {
1384 return arguments.length
1385 ? fn.apply(self, concat(curryArgs, arguments, 0))
1386 : fn.apply(self, curryArgs);
1387 }
1388 : function() {
1389 return arguments.length
1390 ? fn.apply(self, arguments)
1391 : fn.call(self);
1392 };
1393 } else {
1394 // In IE, native methods are not functions so they cannot be bound (note: they don't need to be).
1395 return fn;
1396 }
1397}
1398
1399
1400function toJsonReplacer(key, value) {

Callers 3

getterFunction · 0.70
$CompileProviderFunction · 0.70
applyDirectivesToNodeFunction · 0.70

Calls 3

sliceArgsFunction · 0.70
isFunctionFunction · 0.70
concatFunction · 0.70

Tested by

no test coverage detected