有没有办法可以获得ng-repeat当前记录索引?我试图给每个记录div一个id等于记录索引的例子:
<div id="1">
<div id="2">
<div id="3">
任何一个例子都是高度贬值的。
我使用的ng-repeat如下:
<div ng-repeat="rows in clients.Result">
答案 0 :(得分:4)
$index
包含当前索引。因此,您可以在ng-repeat
{{$index}}
内使用它。
所有这些变量都记录在ng-repeat
documentation的最顶层。
答案 1 :(得分:4)