Skip to content

Commit

Permalink
refactor(text-field): make constructor parameters required (#10431)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crisbeto authored and andrewseguin committed Mar 19, 2018
1 parent 8bc7ee9 commit 5e5aae3
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/cdk/text-field/autosize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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));
});
}
}

Expand Down

0 comments on commit 5e5aae3

Please sign in to comment.