fix(ivy): ensure module imports are instantiated before the module being declared (#35172)

PR Close #35172
This commit is contained in:
Andrew Scott
2020-02-05 14:41:57 -08:00
committed by Misko Hevery
parent 79742a397f
commit 0cbdd54fd0
3 changed files with 49 additions and 6 deletions

View File

@ -289,10 +289,6 @@ export class R3Injector {
return false;
}
// Track the InjectorType and add a provider for it.
this.injectorDefTypes.add(defType);
this.records.set(defType, makeRecord(def.factory, NOT_YET));
// Add providers in the same way that @NgModule resolution did:
// First, include providers from any imports.
@ -330,6 +326,10 @@ export class R3Injector {
}
}
}
// Track the InjectorType and add a provider for it. It's important that this is done after the
// def's imports.
this.injectorDefTypes.add(defType);
this.records.set(defType, makeRecord(def.factory, NOT_YET));
// Next, include providers listed on the definition itself.
const defProviders = def.providers;