lundi 23 novembre 2015

Parsing JSON result to object by using checkbox

I have loaded a JSON list into a table and I would like to parse 1 JSON result or multiple results into an object, so I can send it to the server.

My table looks like this so far:

HTML

<tr ng-repeat="t in student">
    <td ng-model="herkanserNaam">{{ t.Name }}</td>
    <td>{{ t.City }}</td>
    <td>van</td>
    <td>Huis</td>
    <td>j.huis@student.han.nl</td>
    <td>
        <div class="checkbox" ng-click="laatzien(herkanserNaam, herkanserCheck)" ng-model="herkanserCheck">
            <label>
                <input type="checkbox">
            </label>
        </div>
    </td>
</tr>

Controller

$scope.laatzien = function(name, active) {  

    var herkanser = [{
    "name" :  name,
    "active" : false
    }];
    console.log(herkanser);

}

How would I be able to check one or multiple results and save the data(t.Name) into an object by using a checkbox? So far the function laatzien() is returning the empty values defined in herkanser.




Aucun commentaire:

Enregistrer un commentaire