I have a paging cod and I want it to do a count of items, ex: has 40 items and I want to read in 5 pages, then the first page reads 1 of 5, the second and 6 of 10 and the third and 11 of 15 and so on, my cod does that, only the last page is If you have an example, just two items, he keeps making the account as if he had 5, I'll pass the part of the code so he can help me:
$http({
method: 'GET',
url: '/user/distrito?page=' + $scope.page + '&size=' + size
}).then(function(response) {
$scope.distritos = response.data.content;
$scope.number = response.data.number;
$scope.totalDePaginas = response.data.totalPages;
$scope.dados2 = response.data.totalElements;
$scope.primeiraPagina = response.data.first;
$scope.ultimaPagina = response.data.last;
$scope.numeroElementos = response.data.numberOfElements;
$scope.size = response.data.size;
if (size > $scope.dados2) {
$(".proximo").prop("disabled", true);
}
if ($scope.ultimaPagina == true) {
$(".proximo").prop("disabled", true);
$(".anterior").prop("disabled", false);
} else {
$(".anterior").prop("disabled", false);
}
/* if($scope.ultimaPagina == false){
$("#proximo").prop("disabled",false);
}*/
$('.numeracaoUni').text(($scope.number + 1));
* * $('.numeracao').text(' ' + (($scope.size) * $scope.number + 1) + ' - ' + $scope.numeroElementos * ($scope.number + 1)); * *
$('.registros').text(' de ' + $scope.totalDePaginas + ' ');
});
In bold and the part that does this, in the case he does the normal account until the last page because he is multiplying by the size only q is not what I want to have to give the right result at the end. Anyone who can help me, I appreciate it.