Skip to content

Problems with model binding when using nested Arrays #590

Closed
@elbunuelo

Description

@elbunuelo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions