Aurelia - if.bind无法使用select或单选按钮值正常工作

时间:2016-09-13 11:43:31

标签: javascript html aurelia aurelia-binding

我有以下HTML代码

    <select value.bind="selectedA">
      <option repeat.for="optA of optionsA" value.bind="optA.name">${optA.name}</option>
    </select>
    <label repeat.for="optB of optionsB">
      <input type="radio" name="opt" model.bind="optB" checked.bind="selectedB"/>
      ${optB.name}
    </label>

然后我想仅在已定义selectedA和selectedB时才显示容器。

    <section id="container" if.bind="selectedA && selectedB">
      container
    </section>

但是#container永远不会显示,即使已经定义了selectedA和selectedB。使这个工作的唯一选择是在容器div之前打印/使用这些值。

有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

<强>解决

selectedA和selectedB未在.js文件中定义/初始化。