$scope.data = [
{
"name": "Jim",
"id" : 25
},
{
"name": "Jerry",
"id": 27
},
{
"name": "Rithika",
"id": 20
}
];
<div ng-repeat="person in data | filter: {id:20}">
{{parent_index}}
</div>
parent_index - Index of the filtered element in the actual array.
In this example, parent_index should return 2. how to find it?
find the index position of filtered value in the original array
Try this one:
<div ng-repeat="person in data | filter: {id:20}">
{{data.indexOf(person)}}
</div>
Output: 2
Demo Fiddle