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.

32 lines
1.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. angular.module('app.travels', ['pascalprecht.translate'])
  2. .controller('TravelsCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
  3. $scope.travels=[];
  4. $scope.page=0;
  5. $scope.doRefresh = function() {
  6. /* travels refresh: */
  7. $http.get(urlapi + 'travels?page=' + $scope.page)
  8. .then(function(data){
  9. console.log('data success travels');
  10. console.log(data); // for browser console
  11. //$scope.travels = data.data; // for UI
  12. $scope.travels=$scope.travels.concat(data.data);
  13. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  14. }, function(data){
  15. console.log('data error');
  16. $scope.$broadcast('scroll.refreshComplete');//refresher stop
  17. $ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
  18. });
  19. };
  20. $scope.doRefresh();
  21. $scope.paginationNext = function(){
  22. $scope.page++;
  23. console.log($scope.page);
  24. $scope.doRefresh();
  25. };
  26. });