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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Chandermani. Problem solved. I used $first and $last in ng-switch because i cant use ng-if in my version. Thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.