1
 div class ="col-lg-5 stylethistitle"> 
 <input type=" checkbox" ng-model = "checkedStatus">Show Deactivated Account</div> 

I need to pass $scope.checkedStatus in my json request as false when it is selected and true when it is unselected.

I need that for showing deactivated accounts.

Included my JS Below

JS :

  $scope.checkedStatus = true;

$scope.viewAccount = function(){

              var json = {
        "json": {
    "request": {
      "servicetype": "6",
      "functiontype": "6014",
      "session_id": $rootScope.currentSession,
           "data": {
        "shortname": $scope.model.selectShortName,
        "groupzname": $scope.model.selectGname,
        "city": $scope.model.selectCity,
        "state": $scope.model.selectState,
        "country": $scope.model.selectCountry,
        "groupzcode": $scope.model.selectGcode,
         "activationstatus": $scope.checkedStatus,
        "details": false,
        "sortbasedon": $scope.groupzname,
        "offset":$scope.pagination
           }

    }
  }
};
                        $scope.sortkey='';
                        $scope.reverse=false;

              UserService.viewListAccount(json).then(function(response) {

                 if (response.json.response.statuscode == 0 && response.json.response.statusmessage == 'Success')
                        {
                   $scope.tableData = response.json.response.data;

                        }

            }); 
        };
Nicoleta Wilskon
  • 687
  • 1
  • 10
  • 32

2 Answers2

0

Assign a default value for $scope.checkedStatus in the controller. Set it to true or initial value.

Check doc here

Salman
  • 389
  • 4
  • 22
0

you need to set $scope.checkedStatus default to false. and then use it in your json like as -

"activationstatus":!($scope.checkedStatus)