I am having a very strange problem with Ember that I haven't had before. The scenario is quite a lot more complicated than I can outline here so I'll do my best to give a simplified version below.
I have a component which dynamically renders forms from a schema Ember.object(). Something like the below stored as formSchema
on the component, where md-text-input is a normal text input field:
[
{
component: "md-text-input",
value: "some value here",
label: "Text input"
},
{
component: "md-number-input",
value: "9",
label: "Number input"
}
]
The component template then looks like:
{{#each formSchema as |field|}}
{{field.value}}
{{component field.type value=field.value label=field.label}}
{{/each}}
The formSchema
object is changed in the component which causes the form displayed to change.
The first form that renders, the binding works correctly and typing in the input field will update the {{field.value}}
. However, once the formSchema
updates the binding no longer works and although the input field shows the initial value, typing into it will not update field.value
.
Any help is greatly appreciated as I can't seem to get my head around why Ember is losing this binding.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire