angular2-json-schema-form
angular2-json-schema-form copied to clipboard
Feature/update array
PR Type
What changes does this PR include (check all that apply)? [x] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [x] Refactoring (no functional changes, no api changes) [ ] Build process changes [ ] Documentation changes [ ] Other... please describe:
Related issue / current behavior
Two issue here:
- The enum validator was broken due to the build replacing _.isEqual with simply isEqual when it is already defined as a local fn. This caused a circular problem
- The JsonSchemaFormService.updateValue did not handle arrays well, specifically add/removing values. The checkboxes widget seemingly ran into this and created a separate updateArrayCheckboxList method
New behavior
enum validator conflict resolved JsonSchemaFormService.updateArrayCheckboxList renamed to updateArray and set as protected. JsonSchemaFormService.updateValue now calls this internally for arrays.
Does this PR introduce a breaking change?
[x] Yes; JsonSchemaFormService.updateArrayCheckboxList no longer available
@jscharett it's great, but could you help me please? in item I have a nested array, which can changed. and when i try to updateValue I get an error
Error: There are no form controls registered with this array yet. If you're using ngModel, you may want to check next tick (e.g. use setTimeout).
I've tried to exchange setValue to patchValue, but my nested array was removed
@mcnevan Does this PR break your scenario with the nested array, or just not fix it?
@jscharett oh, I think just not fix it