javascript - Angularjs ng-repeat counter -
i using angularjs. have ng-repeat displays questions. need out put question number starts 1 , continues till end of questions. how display , increment such counter in ng-repeat?
<ul> <li ng-repeat="question in questions | filter: {questiontypesid: questiontype, selected: true}"> <div> <span class="name"> {{ question.questiontext }} </span> </div> <ul> <li ng-repeat="answer in question.answers"> <span class="name"> {{answer.selector}}. {{ answer.answertext }} </span> </li> </ul> </li> </ul>
angularjs documentation full of examples, need take time , explore it.
see example here : ngrepeat example , it's same case.
<ul> <li ng-repeat="question in questions | filter: {questiontypesid: questiontype, selected: true}"> <div> <span class="name"> {{$index + 1}} {{ question.questiontext }} </span> </div> <ul> <li ng-repeat="answer in question.answers"> <span class="name"> {{answer.selector}}. {{ answer.answertext }} </span> </li> </ul> </li> </ul>
Comments
Post a Comment