Here When i checked the checkbox only then the checked checkbox value is updated with the previous values otherwise it doesn't update with the previous value. it just added nothing though there were checked chekboxes. I'm working on SharePoint and using rest API. This is my html
<div class="form-group" ng-repeat = "option in beftnBranchChecker track by $index">
<div class="checkerMakerLabel">
<label><input type="checkbox" ng-value="option" ng-checked="{{resultForBEFTNBranchChecker[$index]}}" ng-model="UpdateBEFTNBranchChecker[option]">{{option}}</label>
</div>
this is my controller code
var UpdateBEFTNBranchCheck = [];
angular.forEach($scope.UpdateBEFTNBranchChecker, function (selected,option) {
if(selected){
UpdateBEFTNBranchCheck.push(option);
}
});
newUserAccessSvc.updateUserBeftn(UpdateBEFTNBranchCheck)
.then(function () {
newUserAccessSvc.closeLoading();
alert("User BEFTN Update request has been submitted successfully.");
}, function (error) {
newUserAccessSvc.closeLoading();
alert("Error occurred in User BEFTN.");
});
this is my service code
function updateUserBeftn(beftnBranchCheck) {
var data = {
"__metadata": {
"type": "SP.Data.UsersBEFTNListItem"
},
"BranchCheckerInward" : {
"results" : beftnBranchCheck
}
};
var url = "/_api/web/lists/GetByTitle('Users BEFTN')/GetItemById(" + userBEFTN.id + ")";
return spBaseService.updateRequest(data, url);
}