博文

目前显示的是标签为“$index”的博文

the index position in the original array

1. Using map and indexOf method in an object array var  myArray=[{"id": 1 },{"id":2},{"id":3}]; var pos = myArray.map(function(e) { return e.id; }).indexOf( 1 );// pos === 0 var pos2 = myArray.indexOf({"id":1}); //pos2 always is -1 Ref: http://stackoverflow.com/questions/8668174/indexof-method-in-an-object-array 2. In AngularJS, Using $index OR indexOf( object ) 2.1 indexOf( object ) <div ng-repeat="object in objects">     {{objects.indexOf(person)}} </div> 2.2 using $index value for loops <div ng-repeat="object in objects | filter: {id:20}"> {{$index+1}} <div> Ref:  http://stackoverflow.com/questions/20756694/angularjs-find-the-index-position-of-filtered-value-in-the-original-array