3

I have some code that was working happily pre-blaze that is now not working as expected post blaze and the changes to checkbox handling.

The code is pretty simple

  <div class="modal-footer">
    <label for="packed" class="checkbox-inline input-lg">Packed</label>
      <input type="checkbox" name="packed" id="packed" checked={{isPacked evt}}/>
    {{#if isPacked evt}}
      Packed
    {{else}}
      Not Packed
    {{/if}}
    <label for="delivered" class="checkbox-inline input-lg">Delivered</label>
      <input type="checkbox" name="delivered" id="delivered" disabled={{disDelivered evt}}  checked={{isDelivered evt}}/>
    <button type="button" class="btn btn-default" id="closeEdit">Close</button>
  </div>

The line "Not Packed" is displayed as expected, but, the check boxes are both checked (although both tests return false) and delivered is, as expected disabled.

I can't for the life of me work out why the check boxes are now checked even though the test returns false.

4

1 回答 1

4

Blaze 会自动将返回的对象转换为属性,因此您可以{checked:"checked"}在应该选中复选框时从 isPacked 返回,或者在不应该选中复选框时隐式返回。

于 2014-05-01T01:50:28.643 回答