I have followed this post: How do I bind to list of checkbox values with AngularJS?
To retrieve data from checkbox list and pass it as a Json.
My code is this:
<span ng-repeat="b in neighborhood">
<input id="{{b.Id}}" class="checkcheck" type="checkbox" ng-model="b.checked" ng-change="selection.indexOf(b) > -1"
ng-click="toggleSelection(b)">
{{ b.Name }}
And this my controller code:
$scope.toggleSelection = function toggleSelection(b) {
var idx = $scope.selection.indexOf(b);
if (idx > -1) {
$scope.selection.splice(idx, 1);
}
else {
$scope.selection.push(b);
}
console.log($scope.selection);
ProgramsWS.GetByNeighborhood({ neighborhoodList: $scope.selection }, function (resp) {
console.log(resp);
})
};
The thing is that in the final json, I'm getting something like this:
0 b { Name="Name1", Id=51, checked=true, more...}
1 b { Name="Name2", Id=43, checked=true, more...}
The problems is: Web Service doesn't recognize the "checked" that has been added there in all this process. How can I remove it?