vendredi 22 décembre 2017

Execute funcionts if checkbox is checked or uncheked ? Angular

i have a table with x records, from table i want add items into array (or remove if uncheck row) but i dont know how to execute functions according if checkbox is true or not... but this not work

<tr ng-repeat="item in vm.orders" ng-click="vm.getRow(item)">
  <td></td>
  <td></td>
  <td><input type="checkbox" 
             ng-true-value="vm.addToArray(item)" 
             ng-false-value="vm.removeFromArray(item)" 
  /></td>
</tr>

controller:

function addToArray(model) {
    vm.selectedItems.push(model);
}

function removeFromArray(model) {
   //my logic remove
}




Aucun commentaire:

Enregistrer un commentaire