0

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);
    }

1 Answer 1

0

<div class="form-group" ng-repeat = "option in beftnBranchChecker track by $index">
    <div class="checkerMakerLabel">
        <label>
          <input type="checkbox" 
          ng-value="option.Value" 
          ng-checked="option.IsbeftnBranchChecked" 
          ng-model="option.IsbeftnBranchSelected">{{option}}
        </label>
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.