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
Angularjs Ng重复角js_Angularjs - Fatal编程技术网

Angularjs Ng重复角js

Angularjs Ng重复角js,angularjs,Angularjs,我从服务器获取json作为 [ { "guid":"54db86c947b39358ab2c266a", "modified":0, "created":0, "name":"iOS", "criteria":[ { "name":"Supportability", "value":1, "reasons":[

我从服务器获取json作为

[
   {
      "guid":"54db86c947b39358ab2c266a",
      "modified":0,
      "created":0,
      "name":"iOS",
      "criteria":[
         {
            "name":"Supportability",
            "value":1,
            "reasons":[
               "we do not know the tech"
            ]
         },
         {
            "name":"Core Image",
            "value":1,
            "reasons":[
               "Some reason",
               "Reason 2"
            ]
         },
         {
            "name":"Deployment",
            "value":1,
            "reasons":[
               "no servers"
            ]
         },
         {
            "name":"Hardware",
            "value":1,
            "reasons":[
               "hardware too expensive"
            ]
         },
         {
            "name":"Security",
            "value":1,
            "reasons":[
               "plain text password"
            ]
         },
         {
            "name":"Application",
            "value":0.85,
            "reasons":[
               "332 out of 1600 apps are not package for W10"
            ]
         }
      ],
      "type":"Software"
   },
   {
      "guid":"54db81ab47b3187eceaef46e",
      "modified":0,
      "created":0,
      "name":"Windows 8",
      "criteria":[
         {
            "name":"Supportability",
            "value":1,
            "reasons":[
               "we do not know the tech"
            ]
         },
         {
            "name":"Core Image",
            "value":1,
            "reasons":[
               "Some reason",
               "Reason 2"
            ]
         },
         {
            "name":"Deployment",
            "value":1,
            "reasons":[
               "no servers"
            ]
         },
         {
            "name":"Hardware",
            "value":1,
            "reasons":[
               "hardware too expensive"
            ]
         },
         {
            "name":"Security",
            "value":1,
            "reasons":[
               "plain text password"
            ]
         },
         {
            "name":"Application",
            "value":0.405,
            "reasons":[
               "332 out of 1600 apps are not package for W10"
            ]
         }
      ],
      "type":"Software"
   },
   {
      "guid":"54db81ab47b3187eceaef46f",
      "modified":0,
      "created":0,
      "name":"Windows 10.1",
      "criteria":[
         {
            "name":"Supportability",
            "value":1,
            "reasons":[
               "we do not know the tech"
            ]
         },
         {
            "name":"Core Image",
            "value":1,
            "reasons":[
               "Some reason",
               "Reason 2"
            ]
         },
         {
            "name":"Deployment",
            "value":1,
            "reasons":[
               "no servers"
            ]
         },
         {
            "name":"Hardware",
            "value":1,
            "reasons":[
               "hardware too expensive"
            ]
         },
         {
            "name":"Security",
            "value":1,
            "reasons":[
               "plain text password"
            ]
         },
         {
            "name":"Application",
            "value":0.85,
            "reasons":[
               "332 out of 1600 apps are not package for W10"
            ]
         }
      ],
      "type":"Software"
   }
]
如何在表格中使用ng repeat,以便将表格作为

<th>Criteria</th>
<th>iOs</th>
<th>windows</th>..(basically json.name) 
和我的桌子一样

<tr>
<td>Supportability (json.criteria[0].name)</td>
<td>1</td>(value for iOs)
<td>1</td>(value for Windows10.1)
<td>...................and so on.
</tr>

<tr><td>Core Image</td>
<td>1</td> ......

</tr>

正如其他评论所说,此数据结构不适用于表。这种方式也不是最优的,但是如果您真的想要,可以使用divs来管理它。但是您必须在同一数据上使用多个ng重复,这不好

<div class="section">
  <div class="header">&nbsp;</div>
  <div class="body" ng-repeat="y in mydata[0].criteria">
      {{y.name}}
  </div>
</div>
<div class="section" ng-repeat="x in mydata">
  <div class="header">{{x.name}}</div>
  <div class="body" ng-repeat="y in x.criteria">
      {{y.value}}
  </div>
</div>
普朗克:


我再说一遍,您最好重新构造数据以适应您的输出。

我在您的示例中根本看不到任何角度代码?您的数据层太多,我们无法为您编写解决方案。。。。。向我们展示一些您尝试过但没有达到预期效果的内容。此外,您的数据似乎没有按相同的结构进行格式化,无法跨列重复;您的数据似乎被格式化为跨行重复。看起来您想对数据进行一些旋转。这超出了angular所能做的,因此您需要自己在JS中转换数据,以便获得正确的结构以传递到ng repeat中。条件{{tech.name}{{Criteria.name}{{{Criteria.value}}这就是我一直在尝试的。。如何格式化json以使其成为表行而不是列?请更新您的问题,而不是在注释中发布无法阅读的代码Hanks Malik。那么,我应该如何重新格式化它,以便使用ng repeat实现表格?