jeudi 22 septembre 2016

Values are not automatically assigning in checkbox

I have a checkbox to show deactivate account , when check box is selected in request I need to send activationstatus as false for showing deactivate account and when unchecked it should pass value as true. My checkbox is just passing same value after initialising $scope.checkedStatus = true.Values are not passing as false.

HTML :

<div>
<input type="checkbox" ng-model="checkedStatus" ng-click = "viewAccount">
  Show Deactivated Account
</div> 

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,
        "orderby": "desc",
        "offset":$scope.pagination
           }

    }
  }
};

    UserService.viewListAccount(json).then(function(response) {
    if (response.json.response.statuscode == 0)
                        {
                   $scope.tableData = response.json.response.data; 
                        }
                }); 
        };

Automatically checkbox is not changing the value.




Aucun commentaire:

Enregistrer un commentaire