mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(input): only monitor focus origin on browser platform (#11604)
This commit is contained in:
committed by
Jeremy Elbourn
parent
648eb4a8ba
commit
625f792a44
+10
-5
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user