$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 – 实际数组中过滤的元素的索引。
在这个例子中,parent_index应该返回2.怎么找到呢?
$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 – 实际数组中过滤的元素的索引。
在这个例子中,parent_index应该返回2.怎么找到呢?