()
| 102 | } |
| 103 | |
| 104 | destroy(): void { |
| 105 | if (this._appRef) { |
| 106 | this._appRef.detachView(this); |
| 107 | } else if (this._attachedToViewContainer) { |
| 108 | const parent = this._lView[PARENT]; |
| 109 | if (isLContainer(parent)) { |
| 110 | const viewRefs = parent[VIEW_REFS] as ViewRef<unknown>[] | null; |
| 111 | const index = viewRefs ? viewRefs.indexOf(this) : -1; |
| 112 | if (index > -1) { |
| 113 | ngDevMode && |
| 114 | assertEqual( |
| 115 | index, |
| 116 | parent.indexOf(this._lView) - CONTAINER_HEADER_OFFSET, |
| 117 | 'An attached view should be in the same position within its container as its ViewRef in the VIEW_REFS array.', |
| 118 | ); |
| 119 | detachView(parent, index); |
| 120 | removeFromArray(viewRefs!, index); |
| 121 | } |
| 122 | } |
| 123 | this._attachedToViewContainer = false; |
| 124 | } |
| 125 | destroyLView(this._lView[TVIEW], this._lView); |
| 126 | } |
| 127 | |
| 128 | onDestroy(callback: Function) { |
| 129 | storeLViewOnDestroy(this._lView, callback as () => void); |
nothing calls this directly
no test coverage detected