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

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题