如何声明性地将伪布尔属性(如disabled/checked)绑定到布尔值?

Jan*_*sky 3 polymer

是否有绑定属性像一个简单的方法disabledchecked真/假的性质?就像是

<button disabled="{{myBooleanProperty}}">Ok</button>

不能按预期工作.如果myBooleanProperty是假的,这台disabled="false",这是真实的,只要HTML关注.

是否有一个过滤器表达式可以提示绑定解析器,如果值为false,则应该完全删除该属性?

ebi*_*del 6

请参阅条件属性:http: //www.polymer-project.org/docs/polymer/binding-types.html#conditional-attributes

例:

<button disabled?="{{myBooleanProperty}}">Ok</button>
Run Code Online (Sandbox Code Playgroud)

disabled根据真实性进行切换myBooleanProperty.