()
| 153 | } |
| 154 | |
| 155 | ngAfterViewInit() { |
| 156 | if (this._platform.isBrowser) { |
| 157 | // Remember the height which we started with in case autosizing is disabled |
| 158 | this._initialHeight = this._textareaElement.style.height; |
| 159 | this.resizeToFitContent(); |
| 160 | |
| 161 | this._ngZone.runOutsideAngular(() => { |
| 162 | this._listenerCleanups = [ |
| 163 | this._renderer.listen('window', 'resize', () => this._resizeEvents.next()), |
| 164 | this._renderer.listen(this._textareaElement, 'focus', this._handleFocusEvent), |
| 165 | this._renderer.listen(this._textareaElement, 'blur', this._handleFocusEvent), |
| 166 | ]; |
| 167 | this._resizeEvents.pipe(auditTime(16)).subscribe(() => { |
| 168 | // Clear the cached heights since the styles can change |
| 169 | // when the window is resized (e.g. by media queries). |
| 170 | this._cachedLineHeight = this._cachedPlaceholderHeight = undefined; |
| 171 | this.resizeToFitContent(true); |
| 172 | }); |
| 173 | }); |
| 174 | |
| 175 | this._isViewInited = true; |
| 176 | this.resizeToFitContent(true); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | ngOnDestroy() { |
| 181 | this._listenerCleanups?.forEach(cleanup => cleanup()); |
nothing calls this directly
no test coverage detected