I have the following function.
$('#proximo').click(function() {
token = localStorage.getItem("userToken");
page =0;
var e = document.getElementById("idSelecionaSize");
var size = e.options[e.selectedIndex].value;
var search = $location.search();
var page = search.page||page;
var size = search.size||size;
var sort = search.sort||'type,desc';
page++;
$http({
method: 'GET',
url: '/user/distritosPaginacao?page=' + page + '&size=' + size + '&sort=' + sort
}).then(function(response) {
$scope.distritos = response.data.content;
$scope.number= response.data.number;
$scope.page = response.data.totalPages;
$scope.sort = sort;
$scope.size= response.data.size;
});
});
When the user clicks on the button, the page will receive a value of 1, but in the second click the button will have a value of 1 again. I would like the value to be 2, 3, 4, ... and so on .
How to do it?