11import { Component , Input , ChangeDetectionStrategy , OnChanges } from '@angular/core' ;
22import { FormlyConfig , ValidationMessageOption } from '../services/formly.config' ;
33import { FormlyFieldConfig } from '../components/formly.field.config' ;
4- import { isObject } from '../utils' ;
4+ import { FORMLY_VALIDATORS , isObject } from '../utils' ;
55import { Observable , isObservable , of } from 'rxjs' ;
66import { merge } from 'rxjs' ;
77import { startWith , switchMap , filter } from 'rxjs/operators' ;
@@ -18,6 +18,7 @@ export class FormlyValidationMessage implements OnChanges {
1818 constructor ( private formlyConfig : FormlyConfig ) { }
1919
2020 ngOnChanges ( ) {
21+ const EXPR_VALIDATORS = FORMLY_VALIDATORS . map ( v => `templateOptions.${ v } ` ) ;
2122 this . errorMessage$ = merge (
2223 this . field . formControl . statusChanges ,
2324 (
@@ -27,7 +28,10 @@ export class FormlyValidationMessage implements OnChanges {
2728 filter ( ( { field, type, property } ) => {
2829 return ( field === this . field )
2930 && ( type === 'expressionChanges' )
30- && ( property . indexOf ( 'validation' ) !== - 1 )
31+ && (
32+ ( property . indexOf ( 'validation' ) !== - 1 )
33+ || ( EXPR_VALIDATORS . indexOf ( property ) !== - 1 )
34+ )
3135 ;
3236 } ) ,
3337 )
0 commit comments