I haven't used Polymer since the 0.4-0.5 era and am used to using the hidden attribute like so <my-element hidden="{{foo != bar}}"></my-element>
Now in Polymer 1.0 I see that have to use computed values from a method for anything that is not straight up a boolean value. I have my code like this:
<my-element hidden="{{_computeHidden()}}"></my-element>
And then in the script section:
Polymer({
is: 'super-element',
properties: {...},
_computeHidden: function(){
console.log('its being called, mkay');
return !(foo == bar);
}
});
Now in the console the message comes up twice after page refresh but when the value of foo
changes, the element does not disappear. What am I doing wrong?
"hidden" will appear on the element only if your computed value is truthy
I was trying to figure out how to conditionally apply an attribute all afternoon and the docs are apparently wrong. – Thin