MCPcopy Index your code
hub / github.com/angular-ui/ui-router / bind

Function bind

test/angular/1.5/angular.js:1248–1266  ·  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

1246 * @returns {function()} Function that wraps the `fn` with all the specified bindings.
1247 */
1248function bind(self, fn) {
1249 var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
1250 if (isFunction(fn) && !(fn instanceof RegExp)) {
1251 return curryArgs.length
1252 ? function() {
1253 return arguments.length
1254 ? fn.apply(self, concat(curryArgs, arguments, 0))
1255 : fn.apply(self, curryArgs);
1256 }
1257 : function() {
1258 return arguments.length
1259 ? fn.apply(self, arguments)
1260 : fn.call(self);
1261 };
1262 } else {
1263 // In IE, native methods are not functions so they cannot be bound (note: they don't need to be).
1264 return fn;
1265 }
1266}
1267
1268
1269function toJsonReplacer(key, value) {

Callers 2

getterFunction · 0.70
applyDirectivesToNodeFunction · 0.70

Calls 3

sliceArgsFunction · 0.70
isFunctionFunction · 0.70
concatFunction · 0.70

Tested by

no test coverage detected