Gets the TNode associated with an LView inside of the declaration view.
(lView: LView)
| 1042 | |
| 1043 | /** Gets the TNode associated with an LView inside of the declaration view. */ |
| 1044 | function 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 | } |
no test coverage detected
searching dependent graphs…