Merge pull request #1761 from isocolsky/pagination

using foundation pagination directive
This commit is contained in:
Gustavo Maximiliano Cortez 2014-11-11 13:02:45 -03:00
commit 3c2e881acd
2 changed files with 9 additions and 20 deletions

View file

@ -14,9 +14,16 @@ angular.module('copayApp.controllers').controller('HistoryController',
$scope.currentPage = 1;
$scope.itemsPerPage = 10;
$scope.nbPages = 0;
$scope.totalItems = 0;
$scope.blockchain_txs = [];
$scope.alternativeCurrency = [];
$scope.selectPage = function(page) {
$scope.currentPage = page;
$scope.update();
};
$scope.update = function() {
$scope.getTransactions();
};
@ -28,24 +35,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
}, 1);
};
$scope.nextPage = function() {
$scope.currentPage++;
$scope.update();
};
$scope.previousPage = function() {
$scope.currentPage--;
$scope.update();
};
$scope.hasNextPage = function() {
return $scope.currentPage < $scope.nbPages;
};
$scope.hasPreviousPage = function() {
return $scope.currentPage > 1;
};
$scope.getTransactions = function() {
var w = $rootScope.wallet;
if (!w) return;
@ -72,6 +61,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
});
$scope.blockchain_txs = w.cached_txs = items;
$scope.nbPages = res.nbPages;
$scope.totalItems = res.nbItems;
$scope.loading = false;