I have a Polymer 1.0 custom element which specifies a property named MyItems and an observer _myItemsChanged on this property:
Polymer({
is: 'my-custom-element',
properties: {
MyItems: {
type: Object,
observer: '_myItemsChanged'
},
The template for the custom element includes a dom-repeat which builds up the DOM based on the items in MyItems property:
<template is="dom-repeat" items="{{MyItems}}">
...
</template>
The _myItemsChanged observer performs various manipulations of the DOM. This needs to get called after the template has been "rendered" to reflect the updated MyItems collection.
The issue I'm encountering is that when the _myItemsChanged is called, the DOM for the template has not yet been updated. I can get around this by including a timeout to delay the _myItemsChanged call but this is more of a hack and not really a workable solution.
How can I ensure that the observer function gets called only once the template has completed rendering?