mardi 22 août 2017

add and obtain data of ngRepeat of checkboxes

Well I have a problem, I have a ng-repeat that shows me the users currently, every day I have to add the user's meals, this is why I have 5 checkboxes, 3 have to be marked and 2 not, the problem when ready users add these Data of the meals, but I do not receive any data from the checkbox.

Promptly, I need to add to the data that I receive in my function the value of those checkboxes.

<tr ng-repeat="users in usersData">
    <td>
        
    </td>
    <td>
        
    </td>
    <td>
        
    </td>
    <td>
        
    </td>
    <td>
        <input class="form-control" type="checkbox" style="width: 100px;" ng-model="users.desayuno" ng-checked="true">
    </td>
    <td>
        <input class="form-control" type="checkbox" style="width: 100px;" ng-model="users.almuerzo" ng-checked="true">
    </td>
    <td>
        <input class="form-control" type="checkbox"  style="width: 100px;" ng-model="users.te" ng-checked="true">
    </td>
    <td>
        <input class="form-control" type="checkbox" style="width: 100px;" ng-model="users.cena">
    </td>
    <td>
        <input class="form-control" type="checkbox" style="width: 100px;" ng-model="users.amanecida">
    </td>
</tr>

and here dont show nothing of users.desayuno users.almuerzo users.te users.cena users.amanecida

$scope.saveDataDining = function() {
    angular.forEach($scope.usersData, function(obj) {
      console.log(obj);
    });
  };

here have a plunker with the problem.

http://ift.tt/2v3CSsY




Aucun commentaire:

Enregistrer un commentaire