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

Function findViaNativeElement

packages/core/src/render3/context_discovery.ts:217–226  ·  view source on GitHub ↗

* Locates the element within the given LView and returns the matching index

(lView: LView, target: RElement)

Source from the content-addressed store, hash-verified

215 * Locates the element within the given LView and returns the matching index
216 */
217function findViaNativeElement(lView: LView, target: RElement): number {
218 const tView = lView[TVIEW];
219 for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {
220 if (unwrapRNode(lView[i]) === target) {
221 return i;
222 }
223 }
224
225 return -1;
226}
227
228/**
229 * Locates the next tNode (child, sibling or parent).

Callers 1

getLContextFunction · 0.85

Calls 1

unwrapRNodeFunction · 0.90

Tested by

no test coverage detected