3
<table align="center">
    <tr>
        <th>No</th>
        <th>Movie Title</th>
    </tr>
        <tr data-ng-repeat="mov in movie | pagination: curPage * pageSize | limitTo: pageSize | filter:searchText" data-ng-show="showSuccessMessage" data-ng-click="selectMovie($event,mov)" data-ng-class="{'selected':selectedMovie.film_id===mov.film_id}" style="cursor: pointer;">
            <td>

            </td>
            <td>
                {{mov.title}}
            </td>
        </tr>
    </table>

Aboe code is work properly but how can i count the number and display in No??

Result enter image description here

1
  • 1
    did you speak of $index? it's a variable defined inside ng-repeat, it gives you the actual index of the loop. Commented Mar 1, 2016 at 11:06

2 Answers 2

2

try this

  <table align="center">
        <tr>
            <th>No</th>
            <th>Movie Title</th>
        </tr>
            <tr data-ng-repeat="mov in movie | pagination: curPage * pageSize | limitTo: pageSize | filter:searchText" data-ng-show="showSuccessMessage" data-ng-click="selectMovie($event,mov)" data-ng-class="{'selected':selectedMovie.film_id===mov.film_id}" style="cursor: pointer;">
                <td>
                   {{ $index + 1 }}
                </td>
                <td>
                    {{mov.title}}
                </td>
            </tr>
        </table>
Sign up to request clarification or add additional context in comments.

1 Comment

still you need explanation ,, go through this w3schools.com/angular/angular_tables.asp
2

You can use $index to get the index of the element in an array. It starts with 0. So you can print using $index + 1

Comments

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.