You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polymer's behavior with boolean properties is described in the docs and discussed in #1812, but I still don't see a clean solution for setting a boolean property in markup without using a hack like using an Object type or writing serialization/deserialization methods. Something like this should be possible:
Setting a boolean property from static markup (not using a binding) works fine:
<polymer-element boolean-property> => element.booleanProperty is set to true (if that is a defined property on the element). If it's not a defined property, this just sets the attribute boolean-property.
Setting a boolean property from a binding also works fine:
<polymer-element boolean-property="[[booleanValue]]"> => element.booleanProperty is set to the value of booleanValue. Note that that there's no type coercion. If booleanValue is a string value, like "false", then booleanProperty is also set to the string "false", not boolean false. If you want to coerce the value, you may need to use a computed binding, like boolean-property="[[_toBoolean(notQuiteBooleanValue)]]".
Setting a boolean attribute using a binding also works fine:
<polymer-element boolean-attribute$="[[booleanValue]]"> => boolean-attribute is set, or not set, depending on the value of booleanValue.
All these are documented, so unless we hear back from the OP I think we can close.
Polymer's behavior with boolean properties is described in the docs and discussed in #1812, but I still don't see a clean solution for setting a boolean property in markup without using a hack like using an Object type or writing serialization/deserialization methods. Something like this should be possible:
Using a special syntax would indicate this isn't a standard binding.
The text was updated successfully, but these errors were encountered: