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

我需要在我的 json 请求中将 $scope.checkedStatus 在被选中时作为 false 传递,在未选中时传递 true 。

我需要它来显示已停用的帐户。

在下面包括了我的 JS

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;

                        }

            }); 
        };
4

2 回答 2

0

在控制器中为 $scope.checkedStatus 分配一个默认值。将其设置为真值或初始值。

在这里查看文档

于 2016-09-22T07:09:15.480 回答
0

您需要将 $scope.checkedStatus默认设置为 false。然后在你的 json 中使用它,就像 -

"activationstatus":!($scope.checkedStatus)
于 2016-09-22T07:17:08.900 回答