如何在AngularJS中循环多个表TH

时间:2018-06-13 13:09:02

标签: html angularjs html-table

$ctrl.otherdata

是否可以根据<th>ABC</th> <th>XYZ</th> <th>PQR</th> 的长度

在ng-repeat中进行第3次循环
const string str = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Document><DocumentId>1</DocumentId><Attachment></Attachment><Metadata><DocumentType>0</DocumentType></Metadata></Document>";
var xml = new XmlDocument();
xml.LoadXml(str);

var node = xml.DocumentElement.SelectSingleNode("/Document/Metadata/DocumentType").InnerText;
DocumentType currentEnum = (DocumentType)Enum.Parse(typeof(DocumentType), node);
int currentEnumId = (int)currentEnum;

我试过但看起来它违反了网络标准,我尝试使用DIV,但看起来它不可能在表中,所以任何其他替代方案?

检查附图:这就是我正在寻找使用角度js

的投掷循环

I want table like this using loop

1 个答案:

答案 0 :(得分:2)

这应该有效 -

<table class="table table-bordered">
<thead>
  <tr>
     <th></th>
     <th colspan="3" ng-repeat="din $ctrl.otherdata">{{d.name}}</th>
   </tr>
   <tr>
      <th>User ID</th>
      <th ng-repeat-start="x in $ctrl.otherdata">ABC</th>
      <th>XYZ</th>
      <th ng-repeat-end>PQR</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="data in $ctrl.somedata">
      <td>{{data.name}}</td>
      <td>{{data.x}}</td>
      <td>{{data.y}}</td>
      <td>{{data.z}}</td>

    </tr>

  </tbody>
</table>