Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with model binding when using nested Arrays #590

Closed
elbunuelo opened this issue Nov 10, 2015 · 5 comments
Closed

Problems with model binding when using nested Arrays #590

elbunuelo opened this issue Nov 10, 2015 · 5 comments

Comments

@elbunuelo
Copy link
Contributor

I'm currently using schema form version 0.8.12 with schema form bootstrap version 0.2.0 and I'm trying to use two nested arrays, however the second level array field values end up appearing as [Object object].

I traced back the error to the keyRedaction state attribute inside the array builder (https://github.com/Textalk/angular-schema-form/blob/0.8.12/src/services/builder.js#L136).

From my point of view, the problem is that the keyRedaction from the parent array is carried over to the child array, which causes the key to be an empty array inside the ngModel builder (https://github.com/Textalk/angular-schema-form/blob/0.8.12/src/services/builder.js#L31).

By changing line 136 inside builder.js from state.keyRedaction = state.keyRedaction || 0; to state.keyRedaction = 0; (i.e. resetting the keyRedaction with each nested array), I was able to get it to work properly, but I'm not sure what other repercussions can that change have in the rest of the code.

What do you think about it?

@Anthropic
Copy link
Member

@elbunuelo I've just started to manage the project and would like to thank you for providing a solution in the issue you have raised, it seems to be working for a lot of people, I will see about getting it in the next update.

@elbunuelo
Copy link
Contributor Author

Well, this makes me really happy. If it's all right, I'd like to submit a pull request for the fix

@Anthropic
Copy link
Member

By all means :)

@mpina83
Copy link

mpina83 commented Apr 8, 2016

finally i will be able to remove the manually override from the plugin xD

@Anthropic
Copy link
Member

A PR has been merged for the issue, please test the solution is resolved and re-open if it is not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants