diff --git a/modules/@angular/core/src/application_ref.ts b/modules/@angular/core/src/application_ref.ts index 6c4ea5a649..6333f77b6e 100644 --- a/modules/@angular/core/src/application_ref.ts +++ b/modules/@angular/core/src/application_ref.ts @@ -326,7 +326,7 @@ export class PlatformRef_ extends PlatformRef { .then((moduleFactory) => this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone)); } - private _moduleDoBootstrap(moduleRef: NgModuleInjector) { + private _moduleDoBootstrap(moduleRef: NgModuleInjector): void { const appRef = moduleRef.injector.get(ApplicationRef); if (moduleRef.bootstrapFactories.length > 0) { moduleRef.bootstrapFactories.forEach((compFactory) => appRef.bootstrap(compFactory)); @@ -337,6 +337,7 @@ export class PlatformRef_ extends PlatformRef { `The module ${stringify(moduleRef.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. ` + `Please define one of these.`); } + this._modules.push(moduleRef); } } diff --git a/modules/@angular/core/test/application_ref_spec.ts b/modules/@angular/core/test/application_ref_spec.ts index 5f5cbae71d..9689edd605 100644 --- a/modules/@angular/core/test/application_ref_spec.ts +++ b/modules/@angular/core/test/application_ref_spec.ts @@ -212,6 +212,11 @@ export function main() { expect(mockConsole.res[0]).toEqual('EXCEPTION: ' + expectedErrMsg); }); })); + + it('should add bootstrapped module into platform modules list', async(() => { + defaultPlatform.bootstrapModule(createModule({bootstrap: [SomeComponent]})) + .then(module => expect((defaultPlatform)._modules).toContain(module)); + })); }); describe('bootstrapModuleFactory', () => {