From 625f792a4479848305a6c8d1c16977c379218fb1 Mon Sep 17 00:00:00 2001 From: Artur Androsovych Date: Fri, 24 Aug 2018 17:59:05 +0300 Subject: [PATCH] fix(input): only monitor focus origin on browser platform (#11604) --- src/lib/input/input.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib/input/input.ts b/src/lib/input/input.ts index a42517c45bea..1fd02d06631c 100644 --- a/src/lib/input/input.ts +++ b/src/lib/input/input.ts @@ -254,10 +254,12 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl< } ngOnInit() { - this._autofillMonitor.monitor(this._elementRef).subscribe(event => { - this.autofilled = event.isAutofilled; - this.stateChanges.next(); - }); + if (this._platform.isBrowser) { + this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe(event => { + this.autofilled = event.isAutofilled; + this.stateChanges.next(); + }); + } } ngOnChanges() { @@ -266,7 +268,10 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl< ngOnDestroy() { this.stateChanges.complete(); - this._autofillMonitor.stopMonitoring(this._elementRef); + + if (this._platform.isBrowser) { + this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement); + } } ngDoCheck() {