Skip to content

Commit

Permalink
fix(ajsf/core): json-schema-form service: initializeControl: fix null…
Browse files Browse the repository at this point in the history
… values in enum fromControl-s

force formControl value to empty string when it's null and if the control has enum
Fixes hamzahamidi#333
  • Loading branch information
E-Fir committed Nov 8, 2022
1 parent bb2acac commit c5537bf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/ajsf-core/src/lib/json-schema-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ export class JsonSchemaFormService {
ctx.formControl = this.getFormControl(ctx);
ctx.boundControl = bind && !!ctx.formControl;
if (ctx.formControl) {
if (ctx.options.enum && ctx.formControl.value === null) {
ctx.formControl.value = '';
}

ctx.controlName = this.getFormControlName(ctx);
ctx.controlValue = ctx.formControl.value;
ctx.controlDisabled = ctx.formControl.disabled;
Expand Down

0 comments on commit c5537bf

Please sign in to comment.