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

Function getDirectivesAtNodeIndex

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

Source from the content-addressed store, hash-verified

301 * @param lView The target view data
302 */
303export function getDirectivesAtNodeIndex(nodeIndex: number, lView: LView): any[] | null {
304 const tNode = lView[TVIEW].data[nodeIndex] as TNode;
305 if (tNode.directiveStart === 0) return EMPTY_ARRAY;
306 const results: any[] = [];
307 for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {
308 const directiveInstance = lView[i];
309 if (!isComponentInstance(directiveInstance)) {
310 results.push(directiveInstance);
311 }
312 }
313 return results;
314}
315
316export function getComponentAtNodeIndex(nodeIndex: number, lView: LView): {} | null {
317 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