Skip to content

Commit

Permalink
fix(input): only monitor focus origin on browser platform (angular#11604
Browse files Browse the repository at this point in the history
)
  • Loading branch information
arturovt authored and jelbourn committed Aug 24, 2018
1 parent 648eb4a commit 625f792
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 625f792

Please sign in to comment.