You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(core): Use the retrieve method in the implementation of injectInjectorOnly (angular#60192)
This should keep the existing behavior intact. Right now retrieve never returns back NOT_FOUND. This should not be the case, but tests fail if I do add this behavior so itll have to be later.
PR Closeangular#60192
@@ -64,23 +78,17 @@ export function injectInjectorOnly<T>(
64
78
token: ProviderToken<T>,
65
79
flags=InjectFlags.Default,
66
80
): T|null{
67
-
if(getCurrentInjector()===undefined){
81
+
constcurrentInjector=getCurrentInjector();
82
+
if(currentInjector===undefined){
68
83
thrownewRuntimeError(
69
84
RuntimeErrorCode.MISSING_INJECTION_CONTEXT,
70
85
ngDevMode&&
71
86
`The \`${stringify(token)}\` token injection failed. \`inject()\` function must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`runInInjectionContext\`.`,
0 commit comments