簡體   English   中英

如何從包含angularjs中的json數組的json對象獲取特定值

[英]how to get specific value from json object which contains json array in angularjs

我從mysql數據庫中獲取以下數據,其中“ comment”來自一個表,“ blog”是另一個表。 現在,我想通過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"}
  ]
}

如果認為“ blog_id”是博客表和評論表之間的公共字段。

在mysql“ ON blog.id = comment.blog_id”中編寫一個Join查詢,以便獲得所需的數據,並可以在ng-repeat中顯示響應

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM