File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -254,10 +254,12 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
254
254
}
255
255
256
256
ngOnInit ( ) {
257
- this . _autofillMonitor . monitor ( this . _elementRef ) . subscribe ( event => {
258
- this . autofilled = event . isAutofilled ;
259
- this . stateChanges . next ( ) ;
260
- } ) ;
257
+ if ( this . _platform . isBrowser ) {
258
+ this . _autofillMonitor . monitor ( this . _elementRef . nativeElement ) . subscribe ( event => {
259
+ this . autofilled = event . isAutofilled ;
260
+ this . stateChanges . next ( ) ;
261
+ } ) ;
262
+ }
261
263
}
262
264
263
265
ngOnChanges ( ) {
@@ -266,7 +268,10 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
266
268
267
269
ngOnDestroy ( ) {
268
270
this . stateChanges . complete ( ) ;
269
- this . _autofillMonitor . stopMonitoring ( this . _elementRef ) ;
271
+
272
+ if ( this . _platform . isBrowser ) {
273
+ this . _autofillMonitor . stopMonitoring ( this . _elementRef . nativeElement ) ;
274
+ }
270
275
}
271
276
272
277
ngDoCheck ( ) {
You can’t perform that action at this time.
0 commit comments