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

Function getParentEnvInjector

packages/core/src/debug/ai/di_graph.ts:251–264  ·  view source on GitHub ↗

Find the parent environment injector of the given injector.

(injector: Injector)

Source from the content-addressed store, hash-verified

249
250/** Find the parent environment injector of the given injector. */
251function getParentEnvInjector(injector: Injector): Injector | undefined {
252 if (injector instanceof ChainedInjector) {
253 // We skip `chainedInjector.injector` because that points at the parent element injector
254 // which is handled by `walkElementInjectors`.
255 const chainedInjector = injector;
256 return chainedInjector.parentInjector;
257 } else if (injector instanceof R3Injector) {
258 return injector.parent;
259 } else if (injector instanceof NullInjector) {
260 return undefined;
261 } else {
262 throw new Error(`Unknown injector type: "${injector.constructor.name}".`);
263 }
264}

Callers 1

serializeAncestorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected