fix(core): add bootstrapped modules into platform modules list (#13740)
Closes #12015 PR Close #13740
This commit is contained in:
parent
5f40e5ba21
commit
863285a4b0
|
@ -326,7 +326,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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue