使用 table 标签和AngularJS,如下所示:
<tbody>
<tr ng-repeat="customer in fndCtrl.result">
<td>
1
</td>
<td ng-bind=":customer.CustomerNumber"></td>
<td ng-bind=":customer.FirstName + ' ' + customer.LastName"></td>
我怎么设置行号,然后呢?我在上面设置了1个图像。
答案 0 :(得分:0)
这样做 -
<tbody>
<tr ng-repeat="customer in fndCtrl.result">
<td>
{{$index+1}}
</td>
<td ng-bind=":customer.CustomerNumber"></td>
<td ng-bind=":customer.FirstName + ' ' + customer.LastName"></td>
答案 1 :(得分:0)
将track by $index
添加到ng-repeat。修改后的代码是
<tbody>
<tr ng-repeat="customer in fndCtrl.result track by $index">
<td>
{{ $index + 1 }}
</td>
<td ng-bind=":customer.CustomerNumber"></td>
<td ng-bind=":customer.FirstName + ' ' + customer.LastName"> </td>