Reputation: 94319
<template is="dom-repeat" items="{{fruit_list}}" as="fruit">
<template is="dom-if" if="{{fruit.isOrange}}">
I'm an orange!
</template>
</template>
Here I have a dom-if
template inside a dom-repeat
template. It works great if the value of fruit.isOrange
has already been finalized. However if not, for example, it was true
when before but now I change it to false
, it will remain showing the "I'm an orange!" message.
Shouldn't it be updated automatically? Or did I do something wrong?
Upvotes: 2
Views: 828
Reputation: 3425
I stand to be corrected, but I think the problem is in your dom-repeat not getting notified, causing dom-if to not update also.
You can use this.set('fruit_list.1.isOrange', 'true');
which works for your example.
From Polymer documentation:
set(path, value, root) - Convienence method for setting a value to a path and notifying any elements bound to the same path.
http://polymer.github.io/polymer/
Upvotes: 1