diff --git a/modules/angular2/src/core/di/provider.ts b/modules/angular2/src/core/di/provider.ts index 45274025e0..b01ba83872 100644 --- a/modules/angular2/src/core/di/provider.ts +++ b/modules/angular2/src/core/di/provider.ts @@ -643,9 +643,7 @@ function _extractToken(typeOrFunc, metadata /*any[] | any*/, params: any[][]): D if (!isArray(metadata)) { if (metadata instanceof InjectMetadata) { - var metaArrayWrapper = ListWrapper.createFixedSize(1); - metaArrayWrapper[0] = metadata; - metadata = metaArrayWrapper; + return _createDependency(metadata.token, optional, null, null, depProps); } else { return _createDependency(metadata, optional, null, null, depProps); } diff --git a/modules/angular2/test/core/di/injector_spec.ts b/modules/angular2/test/core/di/injector_spec.ts index 1579f72209..bf4d4e55cd 100644 --- a/modules/angular2/test/core/di/injector_spec.ts +++ b/modules/angular2/test/core/di/injector_spec.ts @@ -646,15 +646,15 @@ export function main() { expect(provider.resolvedFactories[0].dependencies[0].properties) .toEqual([new CustomDependencyMetadata()]); }); - }); - it('should allow declaring dependencies with flat arrays', () => { - var resolved = - Injector.resolve([bind('token').toFactory(e => e, [new InjectMetadata("dep")])]); - var nestedResolved = - Injector.resolve([bind('token').toFactory(e => e, [[new InjectMetadata("dep")]])]); - expect(resolved[0].resolvedFactories[0].dependencies[0].key.token) - .toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token); + it('should allow declaring dependencies with flat arrays', () => { + var resolved = Injector.resolve( + [provide('token', {useFactory: e => e, deps: [new InjectMetadata("dep")]})]); + var nestedResolved = Injector.resolve( + [provide('token', {useFactory: e => e, deps: [[new InjectMetadata("dep")]]})]); + expect(resolved[0].resolvedFactories[0].dependencies[0].key.token) + .toEqual(nestedResolved[0].resolvedFactories[0].dependencies[0].key.token); + }); }); describe("displayName", () => {