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

Function isLViewDescendantOfTNode

packages/core/src/debug/ai/di_graph.ts:236–248  ·  view source on GitHub ↗

* Checks if `lView` is a descendant of `parentTNode` in `parentLView` (crossing view boundaries). * * `tNode.parent` is restricted to referring to nodes within the SAME view. When we cross * view boundaries (e.g., entering a component's internal view or an embedded view like `@if`), * `tNode.par

(lView: LView, parentLView: LView, parentTNode: TNode)

Source from the content-addressed store, hash-verified

234 * `parentLView`.
235 */
236function isLViewDescendantOfTNode(lView: LView, parentLView: LView, parentTNode: TNode): boolean {
237 let currentLView: LView | null = lView;
238 let hostTNode: TNode | null = null;
239
240 while (currentLView && currentLView !== parentLView) {
241 hostTNode = currentLView[T_HOST];
242 currentLView = getLViewParent(currentLView);
243 }
244
245 return (
246 currentLView === parentLView && hostTNode !== null && isTNodeDescendant(hostTNode, parentTNode)
247 );
248}
249
250/** Find the parent environment injector of the given injector. */
251function getParentEnvInjector(injector: Injector): Injector | undefined {

Callers 1

walkElementInjectorsFunction · 0.85

Calls 2

getLViewParentFunction · 0.90
isTNodeDescendantFunction · 0.85

Tested by

no test coverage detected