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

Function getInjectorIndex

packages/core/src/render3/di.ts:234–249  ·  view source on GitHub ↗
(tNode: TNode, lView: LView)

Source from the content-addressed store, hash-verified

232}
233
234export function getInjectorIndex(tNode: TNode, lView: LView): number {
235 if (
236 tNode.injectorIndex === -1 ||
237 // If the injector index is the same as its parent's injector index, then the index has been
238 // copied down from the parent node. No injector has been created yet on this node.
239 (tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex) ||
240 // After the first template pass, the injector index might exist but the parent values
241 // might not have been calculated yet for this instance
242 lView[tNode.injectorIndex + NodeInjectorOffset.PARENT] === null
243 ) {
244 return -1;
245 } else {
246 ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);
247 return tNode.injectorIndex;
248 }
249}
250
251/**
252 * Finds the index of the parent injector, with a view offset if applicable. Used to set the

Callers 2

Calls 1

assertIndexInRangeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…