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

Function getTNodeFromLView

packages/core/src/render3/di.ts:1041–1056  ·  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

1039
1040/** Gets the TNode associated with an LView inside of the declaration view. */
1041function getTNodeFromLView(lView: LView): TElementNode | TElementContainerNode | null {
1042 const tView = lView[TVIEW];
1043 const tViewType = tView.type;
1044
1045 // The parent pointer differs based on `TView.type`.
1046 if (tViewType === TViewType.Embedded) {
1047 ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
1048 return tView.declTNode as TElementContainerNode;
1049 } else if (tViewType === TViewType.Component) {
1050 // Components don't have `TView.declTNode` because each instance of component could be
1051 // inserted in different location, hence `TView.declTNode` is meaningless.
1052 return lView[T_HOST] as TElementNode;
1053 }
1054
1055 return null;
1056}

Callers 2

Calls 1

assertDefinedFunction · 0.90

Tested by

no test coverage detected