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

Function getTNodeFromLView

packages/core/src/render3/di.ts:1054–1069  ·  view source on GitHub ↗

Gets the TNode associated with an LView inside of the declaration view.

(lView: LView)

Source from the content-addressed store, hash-verified

1052
1053/** Gets the TNode associated with an LView inside of the declaration view. */
1054function getTNodeFromLView(lView: LView): TElementNode | TElementContainerNode | null {
1055 const tView = lView[TVIEW];
1056 const tViewType = tView.type;
1057
1058 // The parent pointer differs based on `TView.type`.
1059 if (tViewType === TViewType.Embedded) {
1060 ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
1061 return tView.declTNode as TElementContainerNode;
1062 } else if (tViewType === TViewType.Component) {
1063 // Components don't have `TView.declTNode` because each instance of component could be
1064 // inserted in different location, hence `TView.declTNode` is meaningless.
1065 return lView[T_HOST] as TElementNode;
1066 }
1067
1068 return null;
1069}

Callers 2

Calls 1

assertDefinedFunction · 0.90

Tested by

no test coverage detected