@@ -33,7 +33,7 @@ import {
33
33
MAT_LABEL_GLOBAL_OPTIONS ,
34
34
mixinColor ,
35
35
} from '@angular/material/core' ;
36
- import { fromEvent } from 'rxjs' ;
36
+ import { EMPTY , fromEvent , merge } from 'rxjs' ;
37
37
import { startWith , take } from 'rxjs/operators' ;
38
38
import { MatError } from './error' ;
39
39
import { matFormFieldAnimations } from './form-field-animations' ;
@@ -246,12 +246,10 @@ export class MatFormField extends _MatFormFieldMixinBase
246
246
this . _changeDetectorRef . markForCheck ( ) ;
247
247
} ) ;
248
248
249
- let ngControl = this . _control . ngControl ;
250
- if ( ngControl && ngControl . valueChanges ) {
251
- ngControl . valueChanges . subscribe ( ( ) => {
252
- this . _changeDetectorRef . markForCheck ( ) ;
253
- } ) ;
254
- }
249
+ // Run change detection if the value, prefix, or suffix changes.
250
+ const valueChanges = this . _control . ngControl && this . _control . ngControl . valueChanges || EMPTY ;
251
+ merge ( valueChanges , this . _prefixChildren . changes , this . _suffixChildren . changes )
252
+ . subscribe ( ( ) => this . _changeDetectorRef . markForCheck ( ) ) ;
255
253
256
254
// Re-validate when the number of hints changes.
257
255
this . _hintChildren . changes . pipe ( startWith ( null ) ) . subscribe ( ( ) => {
0 commit comments