polymer: setting individual array elements not working
Binding specified by path eq [[test.0.value]] or dom-repeat have nothing in common with actual data in model. Given:
properties: {
test: {
type: Array,
value: [{value: 0}],
notify: true
}
},
ready: function() {
this.unshift('test', {value: 1});
this.set('test.0.value', 2);
this.set('test.0', {value: 3});
this.set('test.0.value', 4);
this.push('test', {value: 5});
this.$.model.innerText = JSON.stringify(this.get('test'));
}
<header>static path [[test.0.value]]</header>
<div>[0] <span>[[ test.0.value ]]</span></div>
<div>[1] <span>[[ test.1.value ]]</span></div>
<div>[2] <span>[[ test.2.value ]]</span></div>
<header>dom-repeat</header>
<template is="dom-repeat" items="[[test]]">
<div>
[<span>[[index]]</span>] = <span>[[item.value]]</span>
</div>
</template>
<header>actual model</header>
<div id="model"></div>
results in
static path [[test.0.value]]
[0] 3
[1] 2
[2]
dom-repeat
[0] =
[1] = 0
[2] = 5
actual model
[{"value":4},{"value":0},{"value":5}]
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (3 by maintainers)
nothing here works anymore