I'm looping through array of events and show it on front. There is directive "score" inside div, and I want to inject number of array element in the directive code using $index
. Works fine until I tried to add orderBy
to ng-repeat
. And now $index
works based on ordered list. Any suggestion how to inject number of current element of array?
data:
"events" : [{
"event_score" : [0,1]
},
{
"event_score" : [0,1]
},
...
]
This is my code:
<div ng-repeat="e in events | orderBy:'match_time'">
<score index="{{$index}}" user="{{screen_name}}"></score>
</div>