You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.0 KiB

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