In my code below, the if
condition is only evaluated at init. How do I get it to re-evaluate the condition whenever myType
is changed?
<dom-module id="media-element">
<template>
<template is="dom-if" if="[[isType(0)]]">
....
</template>
</template>
<script>
Polymer({
is: 'media-element',
properties: {
myType: {
type: Number,
value: 0
}
},
isType: function(t){return (this.myType===t);}
});
</script>
</dom-module>
You could use a computed binding like this:
codepen
or a computed property like this:
codepen