1.html
<input class="outCheckbox{{$index}}" type="checkbox" ng-init="isCheckbox(item.triggerMode,$index)"
ng-click="outOrInPolice(item.id,$index)">
2.js
$scope.isCheckbox = function (mode, index) {
var a = $timeout(function () {
var outCheckbox = $('.outCheckbox' + index), inCheckbox = $('.inCheckbox' + index);
if (mode === 1) {
outCheckbox.attr('checked', true);
inCheckbox.attr('checked', true);
} else if (mode === 2) {
outCheckbox.attr('checked', true);
inCheckbox.attr('checked', false);
} else {
inCheckbox.attr('checked', true);
outCheckbox.attr('checked', false);
}
$timeout.cancel(a);
})
};
// 驶出/驶入报警 编辑
$scope.outOrInPolice = function (id, index) {
outOrInCommonFun(id, index);
};
function outOrInCommonFun(id, index) {
// console.log(id , index);
var outCheckbox = $(".outCheckbox" + index).is(':checked'),
inCheckbox = $(".inCheckbox" + index).is(':checked');
if (outCheckbox && inCheckbox) {
console.log(1);
$scope.getPoint[index].triggerMode = 1;
} else if (outCheckbox) {
console.log(2);
$scope.getPoint[index].triggerMode = 2;
} else if (inCheckbox) {
console.log(3);
$scope.getPoint[index].triggerMode = 3;
} else {
console.log(0);
$scope.getPoint[index].triggerMode = 0;
}
console.log($scope.getPoint[index]);
setPointCommonFun($scope.getPoint[index], 'edit');
}