【发布时间】:2015-08-19 14:28:54
【问题描述】:
我想在ng-repeat 中增加$index 的值。例如:
<div ng-repeat:x in ProductList">
<label>{{x}}</label> // if x = 1
x++; // this is the line i need
<label style="color:red">{{x}}</label> // x index should be equal to 2
x++; // this is the line i need
<label style="color:blue">{{x}}</label> // x index should be equal to 3
</div>
第二次循环运行时,x索引需要为'4'
【问题讨论】:
-
抱歉,不清楚您在问什么。
-
你想达到什么目的?你能分享你想要的输出吗?
-
见下面的回答。这就是我需要的
-
所以结果和
1, 3, 5, 7一样吗? -
您能告诉我们您的要求吗?也许我们可以建议您最好的解决方案。