style($injector): add a comment to explain the distinction with isArray

This commit is contained in:
Robin Böhm 2013-04-30 00:02:58 +02:00 committed by Pete Bacon Darwin
parent ef7ba7b212
commit d6984db4d5

View file

@ -584,6 +584,8 @@ function createInjector(modulesToLoad) {
var Constructor = function() {},
instance, returnedValue;
// Check if Type is annotated and use just the given function at n-1 as parameter
// e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype;
instance = new Constructor();
returnedValue = invoke(Type, instance, locals);