MCPcopy Create free account
hub / github.com/angular/angular / notFoundValueOrThrow

Function notFoundValueOrThrow

packages/core/src/render3/di.ts:387–397  ·  view source on GitHub ↗
(
  notFoundValue: T | null,
  token: ProviderToken<T>,
  flags: InternalInjectFlags,
)

Source from the content-addressed store, hash-verified

385}
386
387function notFoundValueOrThrow<T>(
388 notFoundValue: T | null,
389 token: ProviderToken<T>,
390 flags: InternalInjectFlags,
391): T | null {
392 if (flags & InternalInjectFlags.Optional || notFoundValue !== undefined) {
393 return notFoundValue;
394 } else {
395 throwProviderNotFoundError(token, 'NodeInjector');
396 }
397}
398
399/**
400 * Returns the value associated to the given token from the ModuleInjector or throws exception

Callers 2

Calls 1

Tested by

no test coverage detected