MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / invoke

Function invoke

lib/test/angular/1.4.3/angular.js:4421–4451  ·  view source on GitHub ↗
(fn, self, locals, serviceName)

Source from the content-addressed store, hash-verified

4419 }
4420
4421 function invoke(fn, self, locals, serviceName) {
4422 if (typeof locals === 'string') {
4423 serviceName = locals;
4424 locals = null;
4425 }
4426
4427 var args = [],
4428 $inject = createInjector.$$annotate(fn, strictDi, serviceName),
4429 length, i,
4430 key;
4431
4432 for (i = 0, length = $inject.length; i < length; i++) {
4433 key = $inject[i];
4434 if (typeof key !== 'string') {
4435 throw $injectorMinErr('itkn',
4436 'Incorrect injection token! Expected service name as string, got {0}', key);
4437 }
4438 args.push(
4439 locals && locals.hasOwnProperty(key)
4440 ? locals[key]
4441 : getService(key, serviceName)
4442 );
4443 }
4444 if (isArray(fn)) {
4445 fn = fn[length];
4446 }
4447
4448 // http://jsperf.com/angularjs-invoke-apply-vs-switch
4449 // #5388
4450 return fn.apply(self, args);
4451 }
4452
4453 function instantiate(Type, locals, serviceName) {
4454 // Check if Type is annotated and use just the given function at n-1 as parameter

Callers 1

instantiateFunction · 0.70

Calls 2

getServiceFunction · 0.70
isArrayFunction · 0.50

Tested by

no test coverage detected