MCPcopy
hub / github.com/angular/angular / getDirectivesAtNodeIndex

Function getDirectivesAtNodeIndex

packages/core/src/render3/context_discovery.ts:319–330  ·  view source on GitHub ↗
(nodeIndex: number, lView: LView)

Source from the content-addressed store, hash-verified

317 * @param lView The target view data
318 */
319export function getDirectivesAtNodeIndex(nodeIndex: number, lView: LView): any[] | null {
320 const tNode = lView[TVIEW].data[nodeIndex] as TNode;
321 if (tNode.directiveStart === 0) return EMPTY_ARRAY;
322 const results: any[] = [];
323 for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
324 const directiveInstance = lView[i];
325 if (!isComponentInstance(directiveInstance)) {
326 results.push(directiveInstance);
327 }
328 }
329 return results;
330}
331
332export function getComponentAtNodeIndex(nodeIndex: number, lView: LView): {} | null {
333 const tNode = lView[TVIEW].data[nodeIndex] as TNode;

Callers 2

getDirectivesFunction · 0.90
getLContextFunction · 0.85

Calls 2

isComponentInstanceFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…