diff --git a/config.xml b/config.xml index 77b4846..f4c7c70 100644 --- a/config.xml +++ b/config.xml @@ -1,11 +1,11 @@ - app + collectiveCar - An Ionic Framework and Cordova project. + CarSharing app, for collective use. - - Your Name Here + + ArnauCode diff --git a/www/js/controllers.js b/www/js/controllers.js index a407ba7..207321e 100644 --- a/www/js/controllers.js +++ b/www/js/controllers.js @@ -1,6 +1,6 @@ -//var urlapi="http://localhost:3000/api/"; -var urlapi="https://collectivecar.paas.primustech.io/api/"; +var urlapi="http://localhost:3000/api/"; +//var urlapi="https://collectivecar.paas.primustech.io/api/"; //localStorage.setItem("c_username", "user2"); @@ -107,6 +107,7 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }, function(response) { // optional // failed + $ionicLoading.show({ template: 'Username already taken', noBackdrop: true, duration: 2000 }); }); }else{ $ionicLoading.show({ template: 'First complete all parameters', noBackdrop: true, duration: 2000 }); @@ -378,14 +379,14 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }; }) -.controller('TravelCtrl', function($scope, $stateParams, $http, $ionicModal, $ionicPopup) { +.controller('TravelCtrl', function($scope, $stateParams, $http, $ionicModal, $ionicPopup, $filter) { if(localStorage.getItem('c_token')){// adding token to the headers $http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token'); } $scope.storageusername=localStorage.getItem("c_username"); $scope.travel=""; console.log($stateParams.travelId); - $http.get(urlapi + 'travels/'+$stateParams.travelId) + /*$http.get(urlapi + 'travels/'+$stateParams.travelId) .success(function(data, status, headers,config){ console.log('data success'); console.log(data); // for browser console @@ -398,7 +399,10 @@ angular.module('starter.controllers', ['pascalprecht.translate']) }) .then(function(result){ travel = result.data; - }); + });*/ + $scope.travels= JSON.parse(localStorage.getItem('c_travels')); + $scope.travel = $filter('filter')($scope.travels, $stateParams.travelId, true)[0]; + $scope.joins=""; $http.get(urlapi + 'travels/join/'+$stateParams.travelId) .success(function(data, status, headers,config){ console.log('data success'); @@ -536,6 +540,7 @@ console.log($scope.newComment); $scope.arrayObjectIndexOf = function(myArray, searchTerm, property) { + console.log(myArray+", "+searchTerm+", "+property); if(myArray) { for(var i = 0, len = myArray.length; i < len; i++) {