测试后HTML,
<table class="table table-condensed" id="QueryTab" style="background:#E0FFFF;">
<thead>
<tr>
<th width="10px"><input type="checkbox" ng-click="checkAll()" ng-model="box.totalState"/></th>
<th>主题</th>
<th>条件</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="data in filterSel track by $index">
<td><input type="checkbox" ng-click="checkOne()" ng-init="$parent.box.state[$index]=false" ng-model="$parent.box.state[$index]"/></td>
<td>{{data.theme}}</td>
<td>{{data.condition[0].key}}</td>
</tr>
</tbody>
</table>
好,js,
/**
*全选、单选
*/
$scope.box={};
$scope.checkAll=function(){
for(var key in $scope.box.state){
$scope.box.state[key]=$scope.box.totalState;
}
}
$scope.checkOne=function(){
console.log($scope.box);
for(var key in $scope.box.state){
if($scope.box.state[key]==false){
$scope.box.totalState=false;
return;
}
}
$scope.box.totalState=true;
}
结束