Sandesh Damkondwar
Sandesh Damkondwar

Reputation: 446

How to re render the dom-if template

How to re render the dom-if template. If function is used instead of boolean variable.

Here goes the jsBin for the above query... https://jsbin.com/lacoguy/edit?html,console,output

I'm trying to re-check the conditions on dom-if templates and re-render them once the dependent values changes.

There is a way for re-rendering template with dom-reapeat. It works like

this.$.templateId.render();

No same luck for template with dom-if.

Upvotes: 1

Views: 848

Answers (1)

Maria
Maria

Reputation: 5604

Looking at your code, I saw that the computed function depends on the property selectedPage, so you should make that property an argument to the function. The function will now re-evaluate whenever the value of selectedPagechanges.

  <template dom-if="isBookingPage(selectedPage)">
    <span>Booking page toolbar rendered</span>
  </template>

Upvotes: 2

Related Questions