MCPcopy Index your code
hub / github.com/angular/angular / getTriggerLView

Function getTriggerLView

packages/core/src/defer/dom_triggers.ts:66–99  ·  view source on GitHub ↗
(
  deferredHostLView: LView,
  deferredTNode: TNode,
  walkUpTimes: number | undefined | null,
)

Source from the content-addressed store, hash-verified

64 * value means that the trigger is in the same LView as the deferred block.
65 */
66export function getTriggerLView(
67 deferredHostLView: LView,
68 deferredTNode: TNode,
69 walkUpTimes: number | undefined | null,
70): LView | null {
71 // The trigger is in the same view, we don't need to traverse.
72 if (walkUpTimes == null) {
73 return deferredHostLView;
74 }
75
76 // A positive value or zero means that the trigger is in a parent view.
77 if (walkUpTimes >= 0) {
78 return walkUpViews(walkUpTimes, deferredHostLView);
79 }
80
81 // If the value is negative, it means that the trigger is inside the placeholder.
82 const deferredContainer = deferredHostLView[deferredTNode.index];
83 ngDevMode && assertLContainer(deferredContainer);
84 const triggerLView = deferredContainer[CONTAINER_HEADER_OFFSET] ?? null;
85
86 // We need to null check, because the placeholder might not have been rendered yet.
87 if (ngDevMode && triggerLView !== null) {
88 const lDetails = getLDeferBlockDetails(deferredHostLView, deferredTNode);
89 const renderedState = lDetails[DEFER_BLOCK_STATE];
90 assertEqual(
91 renderedState,
92 DeferBlockState.Placeholder,
93 'Expected a placeholder to be rendered in this defer block.',
94 );
95 assertLView(triggerLView);
96 }
97
98 return triggerLView;
99}
100
101/**
102 * Gets the element that a deferred block's trigger is pointing to.

Callers 1

pollDomTriggerFunction · 0.85

Calls 5

walkUpViewsFunction · 0.90
assertLContainerFunction · 0.90
getLDeferBlockDetailsFunction · 0.90
assertEqualFunction · 0.90
assertLViewFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…