一、编写js逻辑代码
//批量删除 $scope.selectIds = [];//定义一个集合 $scope.updateSelection = function ($event, id) { if ($event.target.checked) { //$event表示源 如果为true,则添加,如果false则删除 $scope.selectIds.push(id); } else { var idx = $scope.selectIds.indexOf(id);//纯JS(找到该id的索引位置) $scope.selectIds.splice(idx, 1);//参数一(索引的位置) 参数二(删除的个数) } }
二、修改列表的复选框
<td><input type="checkbox" ng-click="updateSelection($event,entity.id)"></td>
三、测试(在空白处显示)
{{selectIds}}