2

How can I get the number of index from the following example in js (angularjs)

        <tr ng-hide="group.$hideRows" ng-repeat="customer in group.data>
            <td>({{$index + 1}}) </td> // << get this number ???
            <td>{{customer.name}}</td>
            <td>{{customer.city}}</td>
            <td>{{customer.tel}}</td>
            <td>{{customer.etc}}</td>
            <td>{{customer.reg}}</td>
        </tr>

The index in my case is 10. But how can I get this value as variable to work with in other functions?

I tried it with $index.length etc. But I didn't get the value 10.

2
  • could you post the code where you want to use $index? Commented Feb 6, 2014 at 13:13
  • Could you create a simple fiddle/plunker with what you want to do? Commented Feb 6, 2014 at 13:28

1 Answer 1

2

If I correct understand question - you get count of items in array with:

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

1 Comment

aaaaaah soo easy and I thaught to complicated all the time. Yes you have understand me correct. Thank you very much! I have my count of the items from each table group now :)

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.