我从mysql数据库中获取以下数据,其中" comment"来自一张桌子和#34;博客"是另一张桌子。现在我想通过ng-repeat显示这些数据。
{
"comment":[
{"comment_id":"3","blog_id":"1","total_comment":"2"},
{"comment_id":"9","blog_id":"8","total_comment":"3"}
],
"blog":[
{"id":"9","title":"jquery","description":"this is about jquery","date":"2016-08-27","status":"active"},
{"id":"8","title":"javascript","description":"this is javascript post","date":"0000-00-00","status":"active"},
{"id":"1","title":"angularjs","description":"this blog is about angularjs.this blog is about angularjs.this blog is about angularjs.this blog is about angularjs.this blog is about angularjs.this blog is about angularjs.","date":"2016-07-12","status":"active"}
]
}
答案 0 :(得分:0)
如果相信“blog_id”是博客表和评论表之间的公共字段。
在mysql“ON blog.id = comment.blog_id”中编写一个Join查询,以便获得所需的数据,并且可以在ng-repeat中显示响应