2016-09-18 10 views
0

「コメント」が1つのテーブルで、「ブログ」が別のテーブルであるmysqlデータベースから次のデータを取得します。今、私はこのデータをng-repeatを通して表示したいと思っています。jsonオブジェクトから特定の値を取得する方法

{ 
    "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"} 
    ] 
} 
+1

で応答を表示することができるように

は「blog.id = comment.blog_id ON」のmysqlに参加するクエリを書きます? – RiggsFolly

+0

{{result.comment.total_comment}} and {{result.blog.title}}

+0

私はすでに応答のデータを取得しています。必要な特定のレコードにアクセスする方法 –

答えて

0

「blog_id」は、ブログテーブルとコメントテーブルの間の共通フィールドと考えられます。あなたが望んでいたデータを取得し、あなたはあなたが何をしようとしたNG-繰り返し

関連する問題