MCPcopy
hub / github.com/angular/angular / getInjector

Function getInjector

packages/core/src/render3/util/discovery_utils.ts:141–148  ·  view source on GitHub ↗
(elementOrDir: Element | {})

Source from the content-addressed store, hash-verified

139 * @publicApi
140 */
141export function getInjector(elementOrDir: Element | {}): Injector {
142 const context = getLContext(elementOrDir)!;
143 const lView = context ? context.lView : null;
144 if (lView === null) return Injector.NULL;
145
146 const tNode = lView[TVIEW].data[context.nodeIndex] as TElementNode;
147 return new NodeInjector(tNode, lView);
148}
149
150/**
151 * Retrieve a set of injection tokens at a given DOM node.

Callers 4

providers_spec.tsFile · 0.90
injectorMethod · 0.90
signal_graph.tsFile · 0.90

Calls 1

getLContextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…