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

Function getTNodeFromLView

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

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

Callers 2

Calls 1

assertDefinedFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…