我有一个复选框来显示停用帐户,当在请求中选中复选框时,我需要将activationstatus 发送为 false 以显示停用帐户,当未选中时,它应该将值传递为 true。我的复选框只是在初始化 $scope.checkedStatus = true 后传递了相同的值。值没有传递为 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;
}
});
};
自动复选框不会更改值。