Am learning on how to display data using angularjs and php. Both Posts and Comments displays fine but the subcomment is not displaying properly based on the comment_id.
 
This is how i do it. I inserted records into subcomment table as follows
  1. insert into subcomment(comment_id,subcomment) values('1''subcomment 1 of commentid 1'); 
  2. insert into subcomment(comment_id,subcomment) values('2''subcomment 1 of commentid 2'); 
  3. insert into subcomment(comment_id,subcomment) values('2''subcomment 2 of commentid 2');  
As you can see, the comment_id1 has 1 subcomment while comment_id2 has 2 subcomment.
 
The issue is that the script shows only the last 2 subcomment of commentid2 for( both commentid1 and commentid2 respectively). The Script does not show the first subcomment belonging to commentid1.
 
its seems that loops for post is what causes the issue. can someone help me fix that. I have also attached the screenshot.
below is the script
  1.   
  2.   
  3.   
  4.   
  5. "style.css" type="text/css" rel="stylesheet" />  
  6.   
  7. "jquery.min.js">  
  8.   
  9. 'myapp'>  
  10. class="content" ng-controller='fetchCtrl' >  
  11. class="post" ng-repeat='post in posts'>  
  12. {{ post.title }}  
  13. class="post-text"> {{ post.content }} 
  
  • class="post-action" 
      
  • Comments  
  • 'comment in post.comments'>  
  • class='comment'>{{ comment.comment }}  
  • {{ comment.id }}