mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(core): support nested arrays of providers in EnvironmentInjector (#45789)
This commit updates the `EnvironmentInjector` logic to support arrays of providers as an argument(for example, when an injector is created via `createEnvironmentInjector` function). PR Close #45789
This commit is contained in:
committed by
Dylan Hunn
parent
29417935de
commit
4e413d9240
@@ -14,7 +14,7 @@ import {Type} from '../interface/type';
|
||||
import {getComponentDef} from '../render3/definition';
|
||||
import {FactoryFn, getFactoryDef} from '../render3/definition_factory';
|
||||
import {throwCyclicDependencyError, throwInvalidProviderError, throwMixedMultiProviderError} from '../render3/errors_di';
|
||||
import {flatten, newArray} from '../util/array_utils';
|
||||
import {deepForEach, flatten, newArray} from '../util/array_utils';
|
||||
import {EMPTY_ARRAY} from '../util/empty';
|
||||
import {stringify} from '../util/stringify';
|
||||
|
||||
@@ -125,9 +125,9 @@ export class R3Injector extends EnvironmentInjector {
|
||||
readonly scopes: Set<InjectorScope>) {
|
||||
super();
|
||||
// Start off by creating Records for every provider.
|
||||
for (const provider of providers) {
|
||||
deepForEach(providers, provider => {
|
||||
this.processProvider(provider as SingleProvider);
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure the INJECTOR token provides this injector.
|
||||
this.records.set(INJECTOR, makeRecord(undefined, this));
|
||||
|
||||
Reference in New Issue
Block a user