I have several checkboxes that you can click on. For every checkbox you click on, an ID, that is connected to the checkbox, is pushed into an array:
HTML:
<tr ng-repeat="info in test">
<td>{{info.stracka}}</td><td>{{info.tid}}</td>
<td><input type="checkbox" id="{{info.id}}" class="checkboxfisk" ng-click="testa(info.id)">
</tr>
Controller:
$scope.testa = function(id) { //När vi klickar i de olika checkboxarna, så fyllas arrayen med dessa
$scope.checkboxes.push(id);
console.log($scope.checkboxes);
};
After this, I'm supposed to send this array containing the ID's to my backend. However, I want to send this Id's in an Object, instead of an array. How can I "push" data, like I do above, into and Object?