MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / invoke

Function invoke

test/fixtures/foo.js:3942–3967  ·  view source on GitHub ↗
(fn, self, locals)

Source from the content-addressed store, hash-verified

3940 }
3941
3942 function invoke(fn, self, locals){
3943 var args = [],
3944 $inject = annotate(fn),
3945 length, i,
3946 key;
3947
3948 for(i = 0, length = $inject.length; i < length; i++) {
3949 key = $inject[i];
3950 if (typeof key !== 'string') {
3951 throw $injectorMinErr('itkn',
3952 'Incorrect injection token! Expected service name as string, got {0}', key);
3953 }
3954 args.push(
3955 locals && locals.hasOwnProperty(key)
3956 ? locals[key]
3957 : getService(key)
3958 );
3959 }
3960 if (isArray(fn)) {
3961 fn = fn[length];
3962 }
3963
3964 // http://jsperf.com/angularjs-invoke-apply-vs-switch
3965 // #5388
3966 return fn.apply(self, args);
3967 }
3968
3969 function instantiate(Type, locals) {
3970 var Constructor = function() {},

Callers 1

instantiateFunction · 0.85

Calls 2

annotateFunction · 0.85
getServiceFunction · 0.85

Tested by

no test coverage detected