考虑这样一个多步形式的标题:
<ul class="steps-selector">
<li>
<a ng-class="{'active':isCurrentStep(0)}" ng-click="setCurrentStep(0)">intro</a>
</li>
<li>
<a ng-class="{'active':isCurrentStep(1)}" ng-click="setCurrentStep(1)">situation</a>
</li>
<li>
<a ng-class="{'active':isCurrentStep(2)}" ng-click="setCurrentStep(2)">prognosis</a>
</li>
</ul>
这些步骤肯定有不同的名称,但ng-class="{'active':isCurrentStep(2)}"
/ ng-click
再次出现正常吗?
答案 0 :(得分:2)
您应该使用ng-repeat
循环播放对象,请参阅documentation
<div ng-repeat="i in [0,1,2]">
<a ng-class="{'active':isCurrentStep($index)}" ng-click="setCurrentStep($index)">intro</a>
</li>