I am trying to observe changes to an array of objects that is passed in to a Polymer element. When a new item is added to the array, the array is also changed in the Polymer element. However, the observer method is never called.
Containing Element
<dom-module is="table-container">
<template>
<selectable-table table-items="{{items}}"></selectable-table>
<button on-click="addItem">Add Item</button>
</template>
<script>
Polymer({
is : "table-container",
attached : function() {
this.items = [];
for (var i = 0; i < 3; i++) {
this.push("items", {
numerical: "1",
english: "one"
});
}
},
addItem : function() {
this.push("items", {
numerical: "3",
english: "three"
})
}
})
</script>
</dom-module>
Trying to observe changes here:
<dom-module id="selectable-table>
<template>
<div>{{tableItems}}</div>
</template>
<script>
Polymer({
is : "selectable-table",
properties : {
tableItems: {
type: Object,
notify: true,
observer: "updateTableItems"
}
}
updateTableItems : function() {
// Updates here
}
});
</script>
</dom-module>
The "updateTableItems" method is being called at first when the items array is first populated but never when the button is clicked to add more objects.