(Type, locals, serviceName)
| 5214 | |
| 5215 | |
| 5216 | function instantiate(Type, locals, serviceName) { |
| 5217 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 5218 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 5219 | var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); |
| 5220 | var args = injectionArgs(Type, locals, serviceName); |
| 5221 | // Empty object at position 0 is ignored for invocation with `new`, but required. |
| 5222 | args.unshift(null); |
| 5223 | return new (Function.prototype.bind.apply(ctor, args))(); |
| 5224 | } |
| 5225 | |
| 5226 | |
| 5227 | return { |
no test coverage detected