(Type, locals, serviceName)
| 4777 | |
| 4778 | |
| 4779 | function instantiate(Type, locals, serviceName) { |
| 4780 | // Check if Type is annotated and use just the given function at n-1 as parameter |
| 4781 | // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); |
| 4782 | var ctor = (isArray(Type) ? Type[Type.length - 1] : Type); |
| 4783 | var args = injectionArgs(Type, locals, serviceName); |
| 4784 | // Empty object at position 0 is ignored for invocation with `new`, but required. |
| 4785 | args.unshift(null); |
| 4786 | return new (Function.prototype.bind.apply(ctor, args))(); |
| 4787 | } |
| 4788 | |
| 4789 | |
| 4790 | return { |
no test coverage detected