diff --git a/src/core/json-schema/src/formly-json-schema.service.ts b/src/core/json-schema/src/formly-json-schema.service.ts index 45c458f8d..db31f5ecc 100644 --- a/src/core/json-schema/src/formly-json-schema.service.ts +++ b/src/core/json-schema/src/formly-json-schema.service.ts @@ -7,6 +7,7 @@ import { ɵgetFieldInitialValue as getFieldInitialValue, ɵclone as clone, } from '@ngx-formly/core'; +import { tap } from 'rxjs/operators'; export interface FormlyJsonschemaOptions { /** @@ -365,6 +366,11 @@ export class FormlyJsonschema { options: schemas .map((s, i) => ({ label: s.title, value: i, disabled: s.readOnly })), }, + hooks: { + onInit: f => f.formControl.valueChanges.pipe( + tap(() => (f.options as any)._checkField(f.parent)), + ), + }, }, { fieldGroup: schemas.map((s, i) => ({