dschnelldavis / angular2-json-schema-form

Angular 2 JSON Schema Form builder
MIT License
285 stars 177 forks source link

The library does not update to the updated data structure if the JSON has array #226

Open bhuvanit opened 6 years ago

bhuvanit commented 6 years ago

Issue type

I'm submitting a (check one): [ ] Bug report [ ] Feature request [ ] Regression (something that used to work, but stopped working in a newer version) [X] Support request [ ] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all): [X] Confirm you are using the latest versions of all necessary packages (or if not, explain why not) [X] Search GitHub for a similar issue or PR [X] If submitting a Support request, also search Stack Overflow for similar issues Note: Please cross-post GitHub support requests to Stack Overflow, and include a link in your GitHub issue to your Stack Overflow question. We do currently respond to support requests on GitHub, but we eventually expect to stop, and will then refer all support questions exclusively to Stack Overflow.

Current behavior

The form does not refresh showing the correct elements when the JSON is passed dynamically. When the page is loaded I am sending the JSON with set of array elements (say the size is 5). But on clicking a button, i change the data and the JSON is updated to set of array elements (say the size is 4). The JSON schema form does not update and show only the 4 elements, it preserves the old values too.

Expected behavior

When the value is updated dynamically, the Angular Schema Form should update dynamically reflecting the updated values.

IMPORTANT: How can we reproduce your problem?

The demo of the issue can be found at https://stackblitz.com/edit/angular-le4ngp.

Environment

OS name & version: Windows 7 Browser name & version: Chrome Angular version: 5 Angular JSON Schema Form version(s): 2 Other relevant software or packages:

Any other relevant information

Deniel9204 commented 6 years ago

Check this workaround: https://stackblitz.com/edit/angular-ye3vre

Use ngIf states for hide/show form.

bhuvanit commented 6 years ago

Thanks this workaround fixes my issue