Angular ng-repeat element count

angularjs

Solution

Something like this

<li ng-repeat="Item in Items">
                <a ng-if="$first" href="#"><   Previous</a>
                <a ng-if="!$first && !$last" href="#">{{$index}}</a>
                <a ng-if="$last" href="#">Next ></a>
    </li>

To get the length use `Items.length`. It becomes more complex if there is a filter. See this SO post

Problem

``` <li ng-repeat="Item in Items"> <div ng-switch="($index)==0"> <div ng-switch-when="true"> <a href="#">< Previous</a> </div> <div ng-switch-when="false"> <a href="#">{{$index}}</a> </div> </div> </li> ``` I want to get element count of the Items and want to show "Next >" for last item

Original source

Related problems