Get the index (counter) of an 'ng-repeat' item with AngularJS?

后端 未结 3 2001
别那么骄傲
别那么骄傲 2021-02-02 06:42

I am using AngularJS and its ng-repeat directive to display a sequence of questions. I need to number each question starting with 1. How do I display a

3条回答
  •  庸人自扰
    2021-02-02 07:42

    Reached here by searching for something similar.

    Here is what worked for me.

    {{$index + 1}}
    

    +1 is added because the index starts from 0.

提交回复
热议问题