$scope.testArr = [ {id:"1",name:"yi"}, {id:"2",name:"er"}, {id:"3",name:"san"}, {id:"4",name:"si"} ] <div class="list"> <div ng-repeat="item in testArr" ng-click="foward(item)">{{item.name}}</div> </div>
问题:根据首次点击选中的项 重新生成数组 当前选中的项为数组的第一个元素,依次类推
例如首次点击的是id为2的项 则新数组为:
[{id:"2",name:"er"},{id:"3",name:"san"}, {id:"4",name:"si"}, {id:"1",name:"yi"}]
首次选中的是id为3的项 新数组为
[{id:"3",name:"san"}, {id:"4",name:"si"},{id:"1",name:"yi"}{id:"2",name:"er"}]
温温酱
相关分类