Closed
Description
Given some sort of input element within a dom-repeat
template, if the element's value is bound to a member of the collection to which the repeating template is bound, the value of the collection's respective item will not update when the element has its value changed.
For example:
<dom-module id="record-card">
<template id="node">
<template is="dom-repeat" items="{{labels}}" observe="{{labels.*}}">
<h1>
<input is="iron-input" bind-value="{{item}}" on-input="labelChanged">
</h1>
</template>
<input is="iron-input" bind-value="{{labels.0}}">
Labels: <span>{{displayLabels(labels.*)}}</span>
</template>
</dom-module>
<script>
Polymer({
is: "record-card",
properties: {
labels: {
type: Array,
notify: true,
value: function() {
return ["Pizza", "Person"]
}
}
},
displayLabels: function(e) {
return e.base.join(', ');
},
labelChanged: function(e) {
console.log(e.model.item);
this.set('item', e.model.item);
}
});
</script>
The iron-input
element bound directly to labels.0
functions as expected. It both a) updates when the value of labels[0]
is changed, and b) updates the value of labels[0]
when its own value is changed.
However, the iron-input
elements inside of the template will not update the values of the array members when input is provided. They will update upon the array being mutated, though.
Live demo at http://jsbin.com/xuhitowiji/1/edit?html,output
Metadata
Assignees
Labels
No labels