dosryjij88555 2016-09-18 11:51
浏览 100

如何从json对象中获取特定值,该对象包含angularjs中的json数组

i get the following data from mysql data base where "comment" is from one table and "blog" is another table . now i want to show this data in view through 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"}
  ]
}
  • 写回答

1条回答 默认 最新

  • donglisi8644 2016-09-18 12:05
    关注

    If believe "blog_id" is the common field between the blog table and the comment table.

    Write a Join query in mysql "ON blog.id = comment.blog_id" so that you get the data you wanted and you may display the response in ng-repeat

    评论

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本