When I add new suggestion $routeParams doesn't find it


#1

Hiii when I add new suggestion and go no comment reference

SrouteParams.id doesn’t find suggestion

{{ post.title }}

	<p>
      <span class="glyphicon glyphicon-plus-sign" ng-click="upVote($index)"></span> Upvotes: {{post.upvotes }}
    </p>
    <a href="#!/suggestion/{{$index}}">Comments</a>
    
</div>

<form ng-submit="addSuggestion()"  style="margin-top: 50px">
  <h3> Submit Your Suggestion </h3>
  <div class="form-group">
    <input type="text" class="form-control" placeholder="Great ideas here" ng-model="title"></input>
  </div>
  <button type="submit" class="btn btn-primary">Suggest</button>
 </form>
it is home.html

app.controller(‘SuggestionController’, [’$scope’, ‘suggestions’, ‘$filter’, ‘$routeParams’,
function($scope, suggestions, $filter, $routeParams) {
$scope.helloWorld = “Hello, AngularJS!”;
//$scope.post = suggestions.posts[$routeParams.id];
$scope.post = $scope.posts[$routeParams.id];
$scope.addComment = function() {

//if input empty, don’t submit
if(!$scope.title || $scope.title === “”) {
return;
}

//push suggestion posts in suggestions.js
$scope.post.comments.push({
title: $scope.title,
upvotes: 0,
});;

//after submit, clear input
$scope.title = ‘’;
//$scope.posts = $filter(‘orderBy’)($scope.posts, ‘-upvotes’);

};

$scope.upVote = function(index) {
//index = posts.indexOf(post);
$scope.post.comments[index].upvotes += 1;
$scope.post.comments = $filter(‘orderBy’)($scope.post.comments, ‘-upvotes’);

};
}]);

it is Suggestion/controller.js


#2

I find solvation - thanks.