(
private readonly ngModuleType: Type<T>,
public _parent: Injector | null,
additionalProviders: Array<Provider | EnvironmentProviders>,
runInjectorInitializers = true,
)
| 46 | destroyCbs: (() => void)[] | null = []; |
| 47 | |
| 48 | constructor( |
| 49 | private readonly ngModuleType: Type<T>, |
| 50 | public _parent: Injector | null, |
| 51 | additionalProviders: Array<Provider | EnvironmentProviders>, |
| 52 | runInjectorInitializers = true, |
| 53 | ) { |
| 54 | super(); |
| 55 | const ngModuleDef = getNgModuleDef(ngModuleType); |
| 56 | ngDevMode && |
| 57 | assertDefined( |
| 58 | ngModuleDef, |
| 59 | `NgModule '${stringify(ngModuleType)}' is not a subtype of 'NgModuleType'.`, |
| 60 | ); |
| 61 | |
| 62 | this._bootstrapComponents = maybeUnwrapFn(ngModuleDef!.bootstrap); |
| 63 | this._r3Injector = createInjectorWithoutInjectorInstances( |
| 64 | ngModuleType, |
| 65 | _parent, |
| 66 | [{provide: viewEngine_NgModuleRef, useValue: this}, ...additionalProviders], |
| 67 | stringify(ngModuleType), |
| 68 | new Set(['environment']), |
| 69 | ) as R3Injector; |
| 70 | |
| 71 | // We need to resolve the injector types separately from the injector creation, because |
| 72 | // the module might be trying to use this ref in its constructor for DI which will cause a |
| 73 | // circular error that will eventually error out, because the injector isn't created yet. |
| 74 | if (runInjectorInitializers) { |
| 75 | this.resolveInjectorInitializers(); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | resolveInjectorInitializers() { |
| 80 | this._r3Injector.resolveInjectorInitializers(); |
nothing calls this directly
no test coverage detected