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

Function getInjectorIndex

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

Source from the content-addressed store, hash-verified

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