refactor(core): fix bootstrapModule
regarding zones and initializers (#10383)
This makes `bootstrapModuleFactory` wait for promises returned by `APP_INITIALIZER`s, also making `bootstrapModuleFactory` async. I.e. now `bootstrapModule` and `bootstrapModuleFactory` behave in the same way. This ensures that all code from module instantiation, to creating `ApplicationRef`s as well as calling `APP_INITIALIZERS` is run in the Angular zone. This also moves the invocation of the initializers from the `ApplicationRef` constructor into the `bootstrapModuleFactory` call, allowing initializers to get a hold of `ApplicationRef` (see #9101). Fixes #9101 Fixes #10363 Fixes #10205
This commit is contained in:
2
tools/public_api_guard/core/index.d.ts
vendored
2
tools/public_api_guard/core/index.d.ts
vendored
@ -979,7 +979,7 @@ export declare abstract class PlatformRef {
|
||||
disposed: boolean;
|
||||
injector: Injector;
|
||||
/** @stable */ bootstrapModule<M>(moduleType: ConcreteType<M>, compilerOptions?: CompilerOptions | CompilerOptions[]): Promise<NgModuleRef<M>>;
|
||||
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): NgModuleRef<M>;
|
||||
/** @experimental */ bootstrapModuleFactory<M>(moduleFactory: NgModuleFactory<M>): Promise<NgModuleRef<M>>;
|
||||
abstract dispose(): void;
|
||||
abstract registerDisposeListener(dispose: () => void): void;
|
||||
}
|
||||
|
2
tools/public_api_guard/router/index.d.ts
vendored
2
tools/public_api_guard/router/index.d.ts
vendored
@ -222,7 +222,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||
|
||||
/** @experimental */
|
||||
export declare class RouterModule {
|
||||
constructor(injector: Injector);
|
||||
constructor(injector: Injector, appRef: ApplicationRef);
|
||||
static forChild(routes: Routes): ModuleWithProviders;
|
||||
static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders;
|
||||
}
|
||||
|
Reference in New Issue
Block a user