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<
254254 }
255255
256256 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+ }
261263 }
262264
263265 ngOnChanges ( ) {
@@ -266,7 +268,10 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
266268
267269 ngOnDestroy ( ) {
268270 this . stateChanges . complete ( ) ;
269- this . _autofillMonitor . stopMonitoring ( this . _elementRef ) ;
271+
272+ if ( this . _platform . isBrowser ) {
273+ this . _autofillMonitor . stopMonitoring ( this . _elementRef . nativeElement ) ;
274+ }
270275 }
271276
272277 ngDoCheck ( ) {
You can’t perform that action at this time.
0 commit comments