$scope.checkAll = function(checked) {
angular.forEach($scope.items,function(item) {
item.$checked = checked;
});
};
$scope.deleteExam = function(id) {
$http({
url : '/deleteexam',params : {
'id' : id,'currentPage' : $scope.currentPage - 1,'numPerPage' : $scope.numPerPage
}
}).success(function(response) {
$scope.TotalItems = response.totalElements;
$scope.items = response.content;
});
}
$scope.deleteItems = function() {
var checkedlist = new Array();
angular.forEach($scope.items,function(item) {
if (item.$checked == true)
checkedlist.push(item.id);
});
$http({
url : "/deleteexams",method : "post",params : {
'ids' : checkedlist,'numPerPage' : $scope.numPerPage
}
}).success(function(response) {
$scope.TotalItems = response.totalElements;
$scope.items = response.content;
});
};
});
@H_
自动化是计算机的一项应用,按计算机应用
分类,它属于____。","op1":"数据处理","op2":"科学计算","op3":"实时控制","op4":"辅助设计","answer":"A","total":2,"totalCorrect":1},{"id":224,"test":"软件由___和文档两部分组成。","op1":"数据","op2":"指令","op3":"程序","op4":"工具","answer":"C",{"id":223,"test":"为达到某一目的而编写的计算机指令序列称为____。","op1":"软件","op2":"字符串","op4":"命令",{"id":222,{"id":220,{"id":219,{"id":218,{"id":217,{"id":216,{"id":215,"totalCorrect":1}],"last":false,"totalPages":9,"totalElements":86,"number":0,"size":10,"sort":[{"direction":"DESC","property":"id","ignoreCase":false,"nullHandling":"NATIVE","ascending":false}],"numberOfElements":10,"first":true}
@H_
404_29@
后台controller代码
getExamsByPage(@RequestParam(value = "currentPage",defaultValue = "0") Integer page,@RequestParam(value = "numPerPage",defaultValue = "10") Integer pageSize) {
Sort sort = new Sort(Direction.DESC,"id");//设置排序方式
Pageable pageable = new PageRequest(page,pageSize,sort);//构建Pageable对象,改
分页查询是通过jpa的PagingAndSortingRepository接口完成的
Page
Exams = examrepository.findAll(pageable);
return Exams;
}
@H_404_29@
repository代码:
{
}
@H_
404_29@
contoller中调用的findAll方法是PagingAndSortingRepository实现的,但是JpaRepository继承自PagingAndSortingRepository,因此也有findAll方法,不明白的同学可以去查阅改接口的资料。
这样就完成了分页显示,图片如下

总结
以上所述是小编给大家介绍的Angular+Bootstrap+Spring Boot实现分页功能实例代码。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持。