From 5e5aae3b2e87b44615fa51aeae81360c2234ed1d Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Mon, 19 Mar 2018 21:18:49 +0100 Subject: [PATCH] refactor(text-field): make constructor parameters required (#10431) Makes the `_ngZone` parameter in `CdkTextareaAutosize` a required one. This was intended as a deletion target, but we hadn't set up deletion targets when it was added. BREAKING CHANGES: * The `_ngZone` parameter in the `CdkTextareaAutosize` constructor is now required. --- src/cdk/text-field/autosize.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/cdk/text-field/autosize.ts b/src/cdk/text-field/autosize.ts index 52a2c2e50db..0cc65d9897f 100644 --- a/src/cdk/text-field/autosize.ts +++ b/src/cdk/text-field/autosize.ts @@ -64,9 +64,7 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy { constructor( private _elementRef: ElementRef, private _platform: Platform, - private _ngZone?: NgZone) {} - - // TODO(crisbeto): make the `_ngZone` a required param in the next major version. + private _ngZone: NgZone) {} /** Sets the minimum height of the textarea as determined by minRows. */ _setMinHeight(): void { @@ -92,13 +90,11 @@ export class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy { if (this._platform.isBrowser) { this.resizeToFitContent(); - if (this._ngZone) { - this._ngZone.runOutsideAngular(() => { - fromEvent(window, 'resize') - .pipe(auditTime(16), takeUntil(this._destroyed)) - .subscribe(() => this.resizeToFitContent(true)); - }); - } + this._ngZone.runOutsideAngular(() => { + fromEvent(window, 'resize') + .pipe(auditTime(16), takeUntil(this._destroyed)) + .subscribe(() => this.resizeToFitContent(true)); + }); } }