added pagination on Blocks, Txs, Addresses

This commit is contained in:
arnaucode
2017-08-31 16:13:50 +02:00
parent 58393a26e9
commit 63a40a05b2
12 changed files with 148 additions and 38 deletions

View File

@@ -2,7 +2,10 @@
<div class="col-md-12">
<div class="panel">
<div class="panel-heading c_deepPurpleG300to500">
<h3 class="panel-title">Last Tx with amount</h3>
<h3 class="panel-title">
Last Blocks with amount
<div ng-click="getBlocks()" class="btn btn-default pull-right">Previous</div>
</h3>
</div>
<div class="panel-body">
<table class="table table-hover">
@@ -45,6 +48,11 @@
</tr>
</tbody>
</table>
<ul class="pager">
<li><a class="withripple" ng-click="getPrev()">Previous</a></li>
Current page: {{page}}
<li><a class="withripple" ng-click="getNext()">Next</a></li>
</ul>
</div>
</div>
</div>

View File

@@ -13,12 +13,26 @@ angular.module('app.blocks', ['ngRoute'])
//last tx
$scope.txs = [];
$http.get(urlapi + 'lasttx')
.then(function(data, status, headers, config) {
console.log(data);
$scope.txs = data.data;
}, function(data, status, headers, config) {
console.log('data error');
});
$scope.page = 1;
$scope.count = 10;
$scope.getBlocks = function() {;
$http.get(urlapi + 'blocks/' + $scope.page + '/' + $scope.count)
.then(function(data, status, headers, config) {
console.log(data);
$scope.txs = data.data;
}, function(data, status, headers, config) {
console.log('data error');
});
};
$scope.getBlocks();
$scope.getPrev = function(){
$scope.page++;
$scope.getBlocks();
};
$scope.getNext = function(){
$scope.page--;
$scope.getBlocks();
};
});