【问题标题】:Ember: bind-attr boolean behavior in input helpersEmber:输入助手中的绑定属性布尔行为
【发布时间】:2014-11-14 23:12:24
【问题描述】:

根据 Ember 的网站:

如果您使用带有布尔值的{{bind-attr}},它将添加或删除 指定的属性。例如,给定这个模板:

假设我在控制器上有一些属性isReadOnly。这很好用:

<input type="text" {{bind-attr disabled=isReadOnly}}> //仅当 isReadOnly 为 true 时才禁用

但是输入助手对布尔值没有这种行为,这对禁用属性很不方便:

{{input type="text" disabled=isReadOnly}} //isReadOnly 不为空时禁用

我希望能够将 isReadOnly 设置为 false 并禁用该框。如何将这种能力与输入助手的好处结合起来?

谢谢(:

【问题讨论】:

    标签: ember.js


    【解决方案1】:

    试试{{input type="text" disabledBinding="isReadOnly"}}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-02
      • 2015-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多