arnaucube
arnaucube/goBlockchainDataAnalysisPublic Self-hosted repository
goBlockchainDataAnalysis/web/views/txs/txs.js
web/views/txs/txs.jsRaw
 1'use strict';
 2
 3angular.module('app.txs', ['ngRoute'])
 4
 5    .config(['$routeProvider', function($routeProvider) {
 6        $routeProvider.when('/txs', {
 7            templateUrl: 'views/txs/txs.html',
 8            controller: 'TxsCtrl'
 9        });
10    }])
11
12    .controller('TxsCtrl', function($scope, $http) {
13
14        //last tx
15        $scope.txs = [];
16        $scope.page = 1;
17        $scope.count = 10;
18        $scope.getTxs = function() {
19            $http.get(urlapi + 'txs/' + $scope.page + '/' + $scope.count)
20                .then(function(data, status, headers, config) {
21                    console.log(data);
22                    $scope.txs = data.data;
23                }, function(data, status, headers, config) {
24                    console.log('data error');
25                });
26        };
27        $scope.getTxs();
28
29        $scope.getPrev = function(){
30                $scope.page++;
31                $scope.getTxs();
32        };
33        $scope.getNext = function(){
34                $scope.page--;
35                $scope.getTxs();
36        };
37    });