Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将json对象呈现为表?_Javascript_Angularjs - Fatal编程技术网

Javascript 如何将json对象呈现为表?

Javascript 如何将json对象呈现为表?,javascript,angularjs,Javascript,Angularjs,首先查看我从后端接收的数据: { "55f6de98f0a50c25f7be4db0":{ "clicks":{ "total":144, "real":1 }, "conversions":{ "total":4, "amount":229 }, "cost":{ "cpc":0.1999999999999995, "ec

首先查看我从后端接收的数据:

{
   "55f6de98f0a50c25f7be4db0":{
      "clicks":{
         "total":144,
         "real":1
      },
      "conversions":{
         "total":4,
         "amount":229
      },
      "cost":{
         "cpc":0.1999999999999995,
         "ecpc":1145.0000000000027,
         "total":28.79999999999993
      },
      "revenue":{
         "total":4,
         "epc":0.027777777777777776
      },
      "net":{
         "roi":-1.1612903225806457,
         "total":4
      },
     "name":"Traffic Source #2",
   },       
   "55f6de98f0a50c25f7be4dbOTHER":{
      "clicks":{
         "total":144,
         "real":1
      },
      "conversions":{
         "total":4,
         "amount":229
      },
      "cost":{
         "cpc":0.1999999999999995,
         "ecpc":1145.0000000000027,
         "total":28.79999999999993
      },
      "revenue":{
         "total":4,
         "epc":0.027777777777777776
      },
      "net":{
         "roi":-1.1612903225806457,
         "total":4
      }
     "name":"Traffic Source #3"
   },

}
现在代码,这个html正是我不想要的:

    <table>
        <tr>
            <th>1 header</th>
            <th>2 header</th>
            <th>3 header</th>
        </tr>
        <tr ng-repeat="thing in things">
            <td>{{thing.asfs}}</td>
            <td>{{thing.asx}}</td>
            <td>{{person.dsf}}</td>
        </tr>
    </table>

1头
2头
3头
{{thing.asfs}}
{{thing.asx}}
{{person.dsf}
我想要这样的东西

<table>
    <tr ng-repeat="head in heads">
        {{head}}
    </tr>
    <tr ng-repeat="bar in bars">
        <td ng-repeat="foo in foos">{{foo[bar]}} //or whatever it is</td>
    </tr>
</table>

{{head}}
{{{foo[bar]}}///或者随便什么
而且,有时该对象会增长,可能会产生更多像这样的键
55f6de98f0ca50c25f7be4db0

我用我收到的数据做了这把小提琴,所以也许你可以帮我拉小提琴

这是设计师给我的完成任务的桌子

其中表示Traffic Source,我需要呈现键/值:
“name”:“Traffic Source#3”
,它出现在每个对象中

有什么建议吗

编辑


不要关闭这一个,因为我将关闭我做的最后一个问题,因为我编辑了很多次,这是一个问题,我需要你帮助我,另一个太冗长。抱歉。

尝试使用AngularJS-谷歌AngularJSON表格

@DanielA.White我只是想寻求帮助,因为这个表格的数据没有像我预期的那样出现。所以请不要删除我的问题。如果您不想提供帮助,则可以。您应该转换为数组,使用
array.map()
创建更好的格式化对象,然后可以更好地显示表格。您的意思是要按特定顺序显示任意一组列吗?您能提供此数据所需的示例表格吗?尝试用作开始