4
<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

Isuru
  • 530
  • 3
  • 9
  • 25

1 Answers1

12

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

Community
  • 1
  • 1
Chandermani
  • 42,589
  • 12
  • 85
  • 88
  • Thanks Chandermani. Problem solved. I used $first and $last in ng-switch because i cant use ng-if in my version. Thanks a lot – Isuru Dec 04 '13 at 07:36