1.引入js文件

<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>

2.HTML中代码的书写
<td><input  type="checkbox" ng-click="updateSelection($event,entity.id)"></td>
$event 代表该行是否被选中
entity.id为自己需要传入的值


3.js代码书写
//定义一个数组
$scope.selectIds=[];
$scope.updateSelection=function($event,id){
if($event.target.checked){
//往数组中加入一个元素
$scope.selectIds.push(id);
}else{
//删除数组中一个元素
var i=$event.selectIds.indexOf(id);
$scope.selectIds.splice(i,1);
}
}
备注:先定义一个数组 selectIds ,如果选中,则往数组中添加一个元素,否则,移除一个元素。


相关文章:

  • 2022-12-23
  • 2021-09-24
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2021-12-27
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2021-12-27
  • 2021-12-27
相关资源
相似解决方案