angular2-json-schema-form icon indicating copy to clipboard operation
angular2-json-schema-form copied to clipboard

Feature/update array

Open jscharett opened this issue 7 years ago • 3 comments

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:

  1. 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
  2. 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 avatar Jul 30 '18 13:07 jscharett

@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

numbsilence avatar Aug 16 '18 11:08 numbsilence

@mcnevan Does this PR break your scenario with the nested array, or just not fix it?

jscharett avatar Aug 16 '18 16:08 jscharett

@jscharett oh, I think just not fix it

numbsilence avatar Aug 16 '18 20:08 numbsilence