fix(core): Injector correctly honors the @Self flag (#24520)

Injector was incorrectly returning instance from parent injector even
when `@Self` was specified.

PR Close #24520
This commit is contained in:
Miško Hevery
2018-06-14 10:36:20 -07:00
parent 27bc7dcb43
commit ccbda9de65
2 changed files with 10 additions and 4 deletions

View File

@ -118,6 +118,8 @@ export function resolveNgModuleDep(
return (
data._providers[index] =
_createProviderInstance(data, data._def.providersByKey[depDef.tokenKey]));
} else if (depDef.flags & DepFlags.Self) {
return notFoundValue;
}
return data._parent.get(depDef.token, notFoundValue);
} finally {