I have a data-bound array (dom-repeat
) in a custom Polymer element, and I need to push new data into the array. It's not displaying the items, even though it knows 2 elements have been added. What am I missing here?
jsFiddle
<link rel="import" href="../../bower_components/polymer/polymer.html">
<dom-module id="main-element">
<template>
<ul>
<template is="dom-repeat" items="{{people}}">
<li>{{item.first}}</li>
</template>
</ul>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'main-element',
properties: {
people: {
type: Array,
value: function() {
return [];
}
}
},
ready: function() {
// Mock data retrieval
this.people.push({"first": "Jane", "last": "Doe"});
this.people.push({"first": "Bob", "last": "Smith"});
}
});
})();
</script>