mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 03:26:44 +01:00
comments inside the travel json
This commit is contained in:
@@ -512,7 +512,7 @@ angular.module('starter.controllers', ['pascalprecht.translate'])
|
|||||||
$scope.newComment.commentAvatar=localStorage.getItem("c_avatar");
|
$scope.newComment.commentAvatar=localStorage.getItem("c_avatar");
|
||||||
console.log($scope.newComment);
|
console.log($scope.newComment);
|
||||||
$http({
|
$http({
|
||||||
url: urlapi + 'travels/comment/' + $stateParams.travelId,
|
url: urlapi + 'travels/'+ $stateParams.travelId+'/comment',
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: $scope.newComment
|
data: $scope.newComment
|
||||||
})
|
})
|
||||||
@@ -520,6 +520,11 @@ console.log($scope.newComment);
|
|||||||
// success
|
// success
|
||||||
console.log("newComment added to server: " + response);
|
console.log("newComment added to server: " + response);
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
$scope.travels=response.data;
|
||||||
|
localStorage.setItem('c_travels', JSON.stringify($scope.travels));
|
||||||
|
localStorage.setItem('c_travelsLastDate', JSON.stringify(new Date()));
|
||||||
|
$scope.travel = $filter('filter')($scope.travels, $stateParams.travelId, true)[0];
|
||||||
|
|
||||||
if(response.data.success==false){
|
if(response.data.success==false){
|
||||||
|
|
||||||
$ionicLoading.show({ template: 'failed to generate new asking package', noBackdrop: true, duration: 2000 });
|
$ionicLoading.show({ template: 'failed to generate new asking package', noBackdrop: true, duration: 2000 });
|
||||||
|
|||||||
@@ -72,9 +72,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="item item-body">
|
<div class="item item-body">
|
||||||
<div ng-show="comments[0]">
|
<div ng-show="travel.comments[0]">
|
||||||
{{'Comments' | translate}}:<br>
|
{{'Comments' | translate}}:<br>
|
||||||
<a ng-repeat="comment in comments" ng-href="#/app/users/{{comment.commentUsername}}" class="item">
|
<a ng-repeat="comment in travel.comments" ng-href="#/app/users/{{comment.commentUsername}}" class="item">
|
||||||
<h3><img ng-src="img/avatars/{{comment.commentAvatar}}.png" class="o-img-joined" />{{comment.commentUsername}}</h3>
|
<h3><img ng-src="img/avatars/{{comment.commentAvatar}}.png" class="o-img-joined" />{{comment.commentUsername}}</h3>
|
||||||
<p>{{comment.comment}}</p>
|
<p>{{comment.comment}}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user