ng-repeat表格无法正确显示

时间:2014-02-18 21:14:43

标签: angularjs

我正在使用简单的ng-repeat指令在表格中显示数据。 但是,当指令呈现时,第一列占用所有空间并取消表格。

在这里看一下plnkr: http://plnkr.co/edit/Hahh4uyQ130zOS8noC3D

请关注文件layout.html

<table>
  <thead>
    <tr ng-repeat="element in header" class="header-cells" style="width:{{element.width}}px">
      <th drop-down-sort-menu>{{element.column}}</th>
    </tr>
  </thead>

  <tbody>
    <tr ng-repeat="element in body">
      <td ng-repeat="h in header" row="{{$parent.$index}}" col="{{$index}}" style="width:{{element.width}}px">{{element[h.column]}}
      </td>
    </tr>
  </tbody>
</table>

我确信这是次要的。任何线索

1 个答案:

答案 0 :(得分:0)

我相信你的问题是,对于标题,你有4个TR只有一个TH,而不是一个TR有4个TH。因此,标题上的单元格与您身体上的单元格不匹配。

在TH级别进行第一次ng-repeat。

尝试一下,让我知道。

相关问题