ng-repeat specify a starting index

后端 未结 9 763
悲哀的现实
悲哀的现实 2020-12-03 06:41

How can I specify an index where an ng-repeat directive is going to start instead of zero?

I have a set of results and I just need to specify the starting one, which

相关标签:
9条回答
  • 2020-12-03 07:12

    This worked for me:

    <element ng-repeat="round in view.rounds track by $index">
        <span>{{$index + 1}}</span>
    </element>
    
    0 讨论(0)
  • 2020-12-03 07:13

    This could do the trick...

    <div ng-repeat="(i, item) in items">
        <p>{{i+1}}</p>
    </div>
    
    0 讨论(0)
  • 2020-12-03 07:16

    The answers seems to be quite old,

    since angular 1.4.0 the limitTo filter takes two parameters

    limitTo: (limit) : (begin)

    you can say ng-repeat="item in list | limitTo:50:0"

    this seems to be a much effective solution rather using two different filters.

    https://code.angularjs.org/1.4.0/docs/api/ng/filter/limitTo

    0 讨论(0)
提交回复
热议问题