Marc Byfield
Marc Byfield

Reputation: 510

Updating a polymer element template

Okay, so I have a bunch of polymer customer element siblings as the different pages of my single page app... They are all contained within a core-animated-pages element. I communicate data via a shared custom element that uses core-localstorage as its backend. Now, one one child is done, it fires an event to let the parent show the next sibling. the fired event may or may not trigger the sibling in question to change its view based on data received from the user in another sibling. This is usually done with templates. What I have found is that, if the change happens on the current page, the template model is updated and it redraws itself based on the updated model. However, if this change affects a sibling that is not yet visible, though its model is infact updated (did some console.log tracing...wasn't fun) the view itself is updated to reflect the change....

What is the best practice to dynamically update the templates of sibling polymer elements?

using Polymer V0.5.5

Upvotes: 0

Views: 132

Answers (1)

Ahmadreza
Ahmadreza

Reputation: 584

One of the patterns is signalling. you can consider using core-signal and then fire a signal and listen in other element for that signal and then take an action based on that.

One thing to note is that if element is inside a conditional template and doest render in shadow dom, it doesnt listen to the events because it doesnt get rendered.

Upvotes: 1

Related Questions