MCPcopy Index your code
hub / github.com/angular/angular / retrieve

Method retrieve

packages/core/src/di/r3_injector.ts:246–262  ·  view source on GitHub ↗
(token: PrimitivesInjectionToken<T>, options?: unknown)

Source from the content-addressed store, hash-verified

244 }
245
246 retrieve<T>(token: PrimitivesInjectionToken<T>, options?: unknown): T | NotFound {
247 const flags: InternalInjectFlags =
248 convertToBitFlags(options as InjectOptions | undefined) || InternalInjectFlags.Default;
249 try {
250 return (this as BackwardsCompatibleInjector).get(
251 token as unknown as InjectionToken<T>,
252 // When a dependency is requested with an optional flag, DI returns null as the default value.
253 THROW_IF_NOT_FOUND as T,
254 flags,
255 );
256 } catch (e: any) {
257 if (isNotFound(e)) {
258 return e;
259 }
260 throw e;
261 }
262 }
263
264 /**
265 * Destroy the injector and release references to every instance or provider associated with it.

Callers

nothing calls this directly

Calls 3

convertToBitFlagsFunction · 0.90
isNotFoundFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected