Bind the "hidden" element of the main list to the attribute (Polymer 0.5)

Delving into the source code of the main list, it looks like it is checking the element hidden attribute using Javascript. But setting <div hidden="false"> hides the div . Is there any way to bind the expression to this Javascript attribute, or do I need to send PR to the main list to explicitly add support?

+8
polymer
source share
2 answers

Can you hide / show polymer elements with hidden ones? attribute.

 <span hidden?="{{showSpan}}">This may or may not be hidden.</span> 

if the boolean expression 'showSpan' is true, the span is displayed; otherwise, it is omitted.

You can switch the showSpan state as follows:

 <div on-click="{{showinput}}"> <span hidden?="{{showSpan}}">This may or may not be hidden</span> </div> Polymer({ showSpan: false, showinput: function() { this.showSpan = !this.showSpan; } }); 
+5
source share

If you want your element not to be hidden, you must remove the hidden attribute. hidden = "false" doesn't mean much in html.

+3
source share

All Articles