Within my controller, I have a function that adds a variable called comments
to the scope.
$scope.showComments = function(id){
dataService.getComments(id).then(function(data){
$scope.comments[id] = data.comments;
console.log($scope.comments);
});
}
I am trying to use ng-repeat on a specific id, but so far it's not functioning as expected. Any suggestions for fixing this issue?
<div class="commentsContainer" id="{{id}}">
<div class="eachcomment" ng-repeat="comment in comments.{{id}}">
<p>{{comment.content}}
</div>
</div>
The correct id is being passed to the outer div, however, the ng-repeat
directive is not working properly.