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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -