在Ng Repeat中以1开始$ index

use*_*229 3 paypal angularjs

有没有办法在ng-repeat中使用1代替0作为初始项目的$ index?我不是要过滤掉数组中的第一项.对于paypal,他们希望第一个是item_num_1 ...使用0不起作用

<div ng-repeat = "item in items">
<input type ="hidden" name ="item_num_{{$index}}" value ="item_num_{{item.id}}">
//the rest like this
</div>
Run Code Online (Sandbox Code Playgroud)

小智 7

也许你可以试试这个.我不确定它是否有效.祝好运

<div ng-repeat = "item in items track by $index">
<input type ="hidden" name ="item_num_{{$index + 1}}" value ="item_num_{{item.id}}">
//the rest like this
</div>
Run Code Online (Sandbox Code Playgroud)