app.controller("baseController",function ($scope) { //获取2个分页参数,网页数据传后台 $scope.reloadlist=function () { $scope.search($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage); } //分页控件 $scope.paginationConf= { //赋值就会发生变化,变化就执行下面的onchange激发一连串的变化 currentPage: 1, //默认目前页码 totalItems: 0, //默认总条数 itemsPerPage: 10, //默认每页条数 perPageOptions: [5,10, 20, 30, 40, 50], //每页展示条数选择 //onChange只要上面默认发生变化就更新,调用reloadlist onChange:function () { $scope.reloadlist();//重新加载,查询 } } //收集ids $scope.selectIds=[]; //更新复选 $scope.updateSelection=function ($event,id) { if($event.target.checked){ $scope.selectIds.push(id); }else { var idx= $scope.selectIds.indexOf(id); //拿到此id的下标 $scope.selectIds.splice(idx,1); //从集合中删除此id } } });
baseController_分页及复选功能(baseController里面放的都是一些通用功能)
最新推荐文章于 2023-08-26 13:48:23 发布