ng-repeat - count within html loop

前端 未结 4 1559
后悔当初
后悔当初 2021-01-02 20:04

Is there anyway to count an item, then display it outside of the loop?


   value.total
         


        
4条回答
  •  情书的邮戳
    2021-01-02 20:59

    total which is initialized in ng-repeat will be of a different scope and can not be accessed outside the loop.

    Try this:

    {{value.total}}
    Total Of All Values: {{ total }}

提交回复
热议问题