(Type, locals, serviceName)
| 5149 | |
| 5150 | |
| 5151 | function instantiate(Type, locals, serviceName) { |
| 5152 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 5153 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 5154 | var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); |
| 5155 | var args = injectionArgs(Type, locals, serviceName); |
| 5156 | // Empty object at position 0 is ignored for invocation with `new`, but required. |
| 5157 | args.unshift(null); |
| 5158 | return new (Function.prototype.bind.apply(ctor, args))(); |
| 5159 | } |
| 5160 | |
| 5161 | |
| 5162 | return { |
no test coverage detected