duanpu5048 2016-02-23 06:51
浏览 7
已采纳

我希望这个json以角度显示

I want this multilevel array of jason in angular format i am not being able to do it. Json file to be displayed in angular goes here. I am able to display properties and geometry not others

{
  "type": "FeatureCollection",   //first fie
   "metadata": {
   "generated": 1456209730000,
   "api": "1.4.0",
 },
   "features": [
    {
       "type": "Feature",
       "properties": {
       "mag": 2.3,
  },
   "geometry": {
    "type": "Point",
    "coordinates": [
     -150.7703,
      63.5849
  ]},
  "id": "ak12869032"
 },
 {
  "type": "Feature",
    "properties": {
    "mag": 2.43
  },
   "geometry": {
     "type": "Point",
     "coordinates": [
     -120.8253326,
      36.6078339
    ]},
    "id": "nc72596150"
   }],
"bbox": [                 //last field
   -150.7703,
   33.7698333
    ]}
  • 写回答

4条回答 默认 最新

  • dourui7186 2016-02-25 18:35
    关注

    Please follow these steps:

    1) create $scope.tempData variable in your controller

    2) get your value in $scope

    3) $scope.tempData=[your json data];

    4) you can use tempData in anywhere within controller.

    for(var d in tempData)
    {
        var data=tempData[d].id;
    }
    

    now you are able to getting id from your json.but for its giving last value. so you can cretae array and pushed on every loop.

    5) if you want use in html can use ng-repeat.

    If you are beginner vist my blog.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000