docs(core): Update inject error documentation (#47020)

The inject function is also available when using EnvironmentInjector.runInContext.

PR Close #47020
This commit is contained in:
Andrew Scott
2022-08-02 09:47:39 -07:00
committed by Andrew Kushnir
parent cb42788785
commit 9e3994c7cc
2 changed files with 5 additions and 4 deletions
@@ -57,7 +57,7 @@ export function injectInjectorOnly<T>(token: ProviderToken<T>, flags = InjectFla
throw new RuntimeError(
RuntimeErrorCode.MISSING_INJECTION_CONTEXT,
ngDevMode &&
`inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
`inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`EnvironmentInjector#runInContext\`.`);
} else if (_currentInjector === null) {
return injectRootLimpMode(token, undefined, flags);
} else {