Skip to content

Commit

Permalink
fix(input): only monitor focus origin on browser platform (#11604)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturovt authored and jelbourn committed Aug 29, 2018
1 parent 09302b6 commit a30e909
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/lib/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit a30e909

Please sign in to comment.