mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 03:26:44 +01:00
travel detail from the current json, not from server
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<widget id="com.ionicframework.app751563" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
<widget id="com.ionicframework.app751563" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||||
<name>app</name>
|
<name>collectiveCar</name>
|
||||||
<description>
|
<description>
|
||||||
An Ionic Framework and Cordova project.
|
CarSharing app, for collective use.
|
||||||
</description>
|
</description>
|
||||||
<author email="you@example.com" href="http://example.com.com/">
|
<author email="mail@mail.com" href="http://arnaucode.com/">
|
||||||
Your Name Here
|
ArnauCode
|
||||||
</author>
|
</author>
|
||||||
<content src="index.html" />
|
<content src="index.html" />
|
||||||
<access origin="*" />
|
<access origin="*" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
//var urlapi="http://localhost:3000/api/";
|
var urlapi="http://localhost:3000/api/";
|
||||||
var urlapi="https://collectivecar.paas.primustech.io/api/";
|
//var urlapi="https://collectivecar.paas.primustech.io/api/";
|
||||||
|
|
||||||
|
|
||||||
//localStorage.setItem("c_username", "user2");
|
//localStorage.setItem("c_username", "user2");
|
||||||
@@ -107,6 +107,7 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
|
|||||||
},
|
},
|
||||||
function(response) { // optional
|
function(response) { // optional
|
||||||
// failed
|
// failed
|
||||||
|
$ionicLoading.show({ template: 'Username already taken', noBackdrop: true, duration: 2000 });
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
$ionicLoading.show({ template: 'First complete all parameters', noBackdrop: true, duration: 2000 });
|
$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
|
if(localStorage.getItem('c_token')){// adding token to the headers
|
||||||
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token');
|
$http.defaults.headers.common['X-Access-Token'] = localStorage.getItem('c_token');
|
||||||
}
|
}
|
||||||
$scope.storageusername=localStorage.getItem("c_username");
|
$scope.storageusername=localStorage.getItem("c_username");
|
||||||
$scope.travel="";
|
$scope.travel="";
|
||||||
console.log($stateParams.travelId);
|
console.log($stateParams.travelId);
|
||||||
$http.get(urlapi + 'travels/'+$stateParams.travelId)
|
/*$http.get(urlapi + 'travels/'+$stateParams.travelId)
|
||||||
.success(function(data, status, headers,config){
|
.success(function(data, status, headers,config){
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
console.log(data); // for browser console
|
console.log(data); // for browser console
|
||||||
@@ -398,7 +399,10 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
|
|||||||
})
|
})
|
||||||
.then(function(result){
|
.then(function(result){
|
||||||
travel = result.data;
|
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)
|
$http.get(urlapi + 'travels/join/'+$stateParams.travelId)
|
||||||
.success(function(data, status, headers,config){
|
.success(function(data, status, headers,config){
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
@@ -536,6 +540,7 @@ console.log($scope.newComment);
|
|||||||
|
|
||||||
|
|
||||||
$scope.arrayObjectIndexOf = function(myArray, searchTerm, property) {
|
$scope.arrayObjectIndexOf = function(myArray, searchTerm, property) {
|
||||||
|
console.log(myArray+", "+searchTerm+", "+property);
|
||||||
if(myArray)
|
if(myArray)
|
||||||
{
|
{
|
||||||
for(var i = 0, len = myArray.length; i < len; i++) {
|
for(var i = 0, len = myArray.length; i < len; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user