Angular2 ngFor how to count the number of looping values?

前端 未结 3 1028
我寻月下人不归
我寻月下人不归 2021-02-07 05:35

I am using ngFor to loop 8 json objects and I want not only to loop the values but also I want to count the number of looping values and display the number.

For example,

3条回答
  •  长情又很酷
    2021-02-07 06:14

    Demo

    • {{i}}. {{item}}
    {{items ? items.length : ''}}

    You could just print the length of the items array.

提交回复
热议问题