refactor(core): don’t use `zone.run` in `ApplicationRef.bootstrap`.
`ApplicationRef.bootstrap` is supposed to be run inside of `ngDoBootstrap` method of the module that is bootstrapped, and that method already runs inside of the zone.
This commit is contained in:
parent
630028350a
commit
1ab5eb0844
|
@ -549,13 +549,11 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
'Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
'Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
||||||
}
|
}
|
||||||
return this.run(() => {
|
|
||||||
let componentFactory: ComponentFactory<C>;
|
let componentFactory: ComponentFactory<C>;
|
||||||
if (componentOrFactory instanceof ComponentFactory) {
|
if (componentOrFactory instanceof ComponentFactory) {
|
||||||
componentFactory = componentOrFactory;
|
componentFactory = componentOrFactory;
|
||||||
} else {
|
} else {
|
||||||
componentFactory =
|
componentFactory = this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
|
||||||
this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
|
|
||||||
}
|
}
|
||||||
this._rootComponentTypes.push(componentFactory.componentType);
|
this._rootComponentTypes.push(componentFactory.componentType);
|
||||||
var compRef = componentFactory.create(this._injector, [], componentFactory.selector);
|
var compRef = componentFactory.create(this._injector, [], componentFactory.selector);
|
||||||
|
@ -572,7 +570,6 @@ export class ApplicationRef_ extends ApplicationRef {
|
||||||
`Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.`);
|
`Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.`);
|
||||||
}
|
}
|
||||||
return compRef;
|
return compRef;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
|
Loading…
Reference in New Issue