Domanda

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.

È stato utile?

Soluzione

Blaze will automatically turn returned object into attributes so you could return {checked:"checked"} from isPacked when the checkbox should be checked or return implicitly when it should not be.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top