<table align="center">
<tr>
<th>No</th>
<th>Movie Title</th>
</tr>
<tr data-ng-repeat="mov in movie | pagination: curPage * pageSize | limitTo: pageSize | filter:searchText" data-ng-show="showSuccessMessage" data-ng-click="selectMovie($event,mov)" data-ng-class="{'selected':selectedMovie.film_id===mov.film_id}" style="cursor: pointer;">
<td>
</td>
<td>
{{mov.title}}
</td>
</tr>
</table>
Aboe代码工作正常,但我如何计算数字并显示在否 ??
答案 0 :(得分:1)
您可以使用$index
来获取数组中元素的索引。它从0开始。因此您可以使用$index + 1
答案 1 :(得分:1)
试试这个
<table align="center">
<tr>
<th>No</th>
<th>Movie Title</th>
</tr>
<tr data-ng-repeat="mov in movie | pagination: curPage * pageSize | limitTo: pageSize | filter:searchText" data-ng-show="showSuccessMessage" data-ng-click="selectMovie($event,mov)" data-ng-class="{'selected':selectedMovie.film_id===mov.film_id}" style="cursor: pointer;">
<td>
{{ $index + 1 }}
</td>
<td>
{{mov.title}}
</td>
</tr>
</table>