I'm trying to dynamically generate a form using ember-form-for. Ember-form-for works with objects that {arg1: val1, arg2: val2, ... foo:bar}
. Description of my fields a bit more complex, so it is represented as an array with {name: foo, value: bar, defaultValue: foobar}
. For such cases it is possible to use fields-for helper. Thanks to documentation this is easy to setup.
My problem is that I want to use ember-changeset to commit/validate all changes at once. Integration part is also described on the github page. And it works perfectly as long as you use the simple format but with my format it does not work because it can not detect changes. IMHO because it works only on surface level.
In order to fix that issue, I have created a computed property that is a simple representation generated from my complex one. Afterwards, I generate form fields using both of these variables. It works but I believe there should be less hacky solution.
Aucun commentaire:
Enregistrer un commentaire