From 237dec4dfc75ab214b7d2ed97dbfc78c1f4830bd Mon Sep 17 00:00:00 2001
From: arnaucode
Date: Wed, 1 Feb 2017 18:14:38 +0100
Subject: [PATCH] pagination added to travels feed
---
www/js/app.js | 4 ++--
www/js/travels.js | 13 ++++++++++---
www/templates/travels.html | 3 +++
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/www/js/app.js b/www/js/app.js
index ab47441..bc87a74 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -6,9 +6,9 @@
// 'starter.controllers' is found in controllers.js
-//var urlapi = "http://localhost:3000/api/";
+var urlapi = "http://localhost:3000/api/";
//var urlapi="https://collectivecar.paas.primustech.io/api/";
-var urlapi="http://147.83.7.158:3000/api/";
+//var urlapi="http://147.83.7.158:3000/api/";
angular.module('starter', [
diff --git a/www/js/travels.js b/www/js/travels.js
index afe70d9..896b5dd 100644
--- a/www/js/travels.js
+++ b/www/js/travels.js
@@ -4,14 +4,15 @@ angular.module('app.travels', ['pascalprecht.translate'])
$scope.travels=[];
-
+ $scope.page=0;
$scope.doRefresh = function() {
/* travels refresh: */
- $http.get(urlapi + 'travels')
+ $http.get(urlapi + 'travels?page=' + $scope.page)
.then(function(data){
console.log('data success travels');
console.log(data); // for browser console
- $scope.travels = data.data; // for UI
+ //$scope.travels = data.data; // for UI
+ $scope.travels=$scope.travels.concat(data.data);
$scope.$broadcast('scroll.refreshComplete');//refresher stop
}, function(data){
@@ -22,4 +23,10 @@ angular.module('app.travels', ['pascalprecht.translate'])
});
};
$scope.doRefresh();
+
+ $scope.paginationNext = function(){
+ $scope.page++;
+ console.log($scope.page);
+ $scope.doRefresh();
+ };
});
diff --git a/www/templates/travels.html b/www/templates/travels.html
index bb47dfe..61b3fed 100644
--- a/www/templates/travels.html
+++ b/www/templates/travels.html
@@ -34,5 +34,8 @@
+
+ load more
+