(Type, locals, serviceName)
| 5099 | |
| 5100 | |
| 5101 | function instantiate(Type, locals, serviceName) { |
| 5102 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 5103 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 5104 | var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); |
| 5105 | var args = injectionArgs(Type, locals, serviceName); |
| 5106 | // Empty object at position 0 is ignored for invocation with `new`, but required. |
| 5107 | args.unshift(null); |
| 5108 | return new (Function.prototype.bind.apply(ctor, args))(); |
| 5109 | } |
| 5110 | |
| 5111 | |
| 5112 | return { |
no test coverage detected