I've created one form there are multiple checkbox at edit time that form checkbox is coming with checked using below code.
View
<form method="POST" name="LeadCircle" role="form" ng-submit="addLeadCircle()">
<input type="hidden" ng-model="form.addleadcircle.leadId" name="leadId" />
<div class="select-basket">
<div class="checkbox" ng-repeat="circle in circles">
<input class="checkboxCircle" type="checkbox" ng-checked="{{circle.checked}}" name="leadcircle[]" ng-model="form.addleadcircle.leadcircle[circle.Id]" value="{{circle.Id}}" id="cb-{{circle.Id}}">
<label for="cb-{{circle.Id}}">{{circle.Name}}</label>
</div>
</div>
<button type="submit" class="btn btn-outline-secondary button-sm text-uppercase pull-right">Add</button>
</form>
AnguarJS
$scope.addLeadCircle = function () {
console.log($scope.form.addleadcircle);
return false;
dataFactory.httpRequest(base_url + 'leadCircles/addLeadCircle', 'POST', {}, $scope.form.addleadcircle).then(function (data) {
alertify.notify('Assign circle successfully', 'success', 5, function () {});
return;
});
}
This code also shows checked checkbox which value need to check. but what happen if I'm try to submit form it will not gives value of this already checked checkbox If I'm going to select new checkbox it will gives value of that newly checked checkbox.
Now in console at edit form If I will submit form directly without checked any checkbox so It will take only hidden input value not already selected checkbox value. If I am select new checkbox then it takes only newly selected checkbox value.
Any one can please help on this Thanks in advance.