2016-09-18 6 views
0

"메모"가 하나의 테이블에 있고 "블로그"가 다른 테이블 인 다음 데이터가 mysql 데이터베이스에서 가져옵니다. 지금은 ng-repeat를 통해이 데이터를 보여주고 싶습니다.angularjs에서 json 배열을 포함하는 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

은 그래서 당신이 시도-반복 NG 당신의 응답을 표시 할 수 있습니다? – RiggsFolly

+0

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

+0

나는 이미 내가 원하는 특정 레코드에 액세스하는 방법에 대한 응답으로 데이터를 얻었습니다. –

답변

0

"blog_id"가 블로그 테이블과 댓글 테이블 사이의 공통 필드라고 생각하는 경우 당신은 당신이 원하는 데이터를 얻을 수 있도록

는 "이 blog.id = comment.blog_id ON"MySQL의에 쿼리를 가입 쓰기

관련 문제