Skip to content

Commit

Permalink
fix(core): add bootstrapped modules into platform modules list
Browse files Browse the repository at this point in the history
Closes #12015
  • Loading branch information
Dzmitry Shylovich authored and Dzmitry Shylovich committed Jan 1, 2017
1 parent cbeb9b3 commit db07de6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/@angular/core/src/application_ref.ts
Expand Up @@ -334,7 +334,7 @@ export class PlatformRef_ extends PlatformRef {
.then((moduleFactory) => this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone));
}

private _moduleDoBootstrap(moduleRef: NgModuleInjector<any>) {
private _moduleDoBootstrap(moduleRef: NgModuleInjector<any>): void {
const appRef = moduleRef.injector.get(ApplicationRef);
if (moduleRef.bootstrapFactories.length > 0) {
moduleRef.bootstrapFactories.forEach((compFactory) => appRef.bootstrap(compFactory));
Expand All @@ -345,6 +345,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);
}
}

Expand Down
5 changes: 5 additions & 0 deletions modules/@angular/core/test/application_ref_spec.ts
Expand Up @@ -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((<any>defaultPlatform)._modules).toContain(module));
}));
});

describe('bootstrapModuleFactory', () => {
Expand Down

0 comments on commit db07de6

Please sign in to comment.