Skip to content

Commit c5537bf

Browse files
committed
fix(ajsf/core): json-schema-form service: initializeControl: fix null values in enum fromControl-s
force formControl value to empty string when it's null and if the control has enum Fixes hamzahamidi#333
1 parent bb2acac commit c5537bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

projects/ajsf-core/src/lib/json-schema-form.service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,10 @@ export class JsonSchemaFormService {
544544
ctx.formControl = this.getFormControl(ctx);
545545
ctx.boundControl = bind && !!ctx.formControl;
546546
if (ctx.formControl) {
547+
if (ctx.options.enum && ctx.formControl.value === null) {
548+
ctx.formControl.value = '';
549+
}
550+
547551
ctx.controlName = this.getFormControlName(ctx);
548552
ctx.controlValue = ctx.formControl.value;
549553
ctx.controlDisabled = ctx.formControl.disabled;

0 commit comments

Comments
 (0)