Let's say I have the following array
$scope.stuff = [
{name: "one", order: 1},
{name: "three", order: 3},
{name: "two", order: 2}
]
Then I list it using ng-repeat
like so:
<div ng-repeat="(key, data) in stuff | orderBy:'-order'">
{{ data.name }} - {{ key }} - {{ $index }}
<br />
</div>
It then would display:
1 - 0 - 0
2 - 1 - 1
3 - 2 - 2
I'd like to be able to know where in the ACTUAL array, these items are coming from in $scope.stuff
So I'd like to know that 3
is actually in array index 1 in $scope.stuff
and not just array index 2 in my sorted ng-repeat
.
I'm new to angular but does anyone have any suggestions?