| 158 | } |
| 159 | |
| 160 | ngOnDestroy(): void { |
| 161 | if (this._subscription) { |
| 162 | this._dispose(); |
| 163 | } |
| 164 | // Clear the `ChangeDetectorRef` and its association with the view data, to mitigate |
| 165 | // potential memory leaks in Observables that could otherwise cause the view data to |
| 166 | // be retained. |
| 167 | // https://github.com/angular/angular/issues/17624 |
| 168 | this._ref = null; |
| 169 | } |
| 170 | |
| 171 | // NOTE(@benlesh): Because Observable has deprecated a few call patterns for `subscribe`, |
| 172 | // TypeScript has a hard time matching Observable to Subscribable, for more information |