angular$index获取ng-repeat的上一条数据
来源:动视网
责编:小采
时间:2020-11-27 20:20:14
angular$index获取ng-repeat的上一条数据
angular$index获取ng-repeat的上一条数据: <div ng-repeat=item in dataList ng-click=func($index,$index-1)></div> $scope.func = function(thisIndex,preIndex){ var thisIndexDataName = $scope.dataList[thisIndex].dataName;//当前这条数据对应dataName var preIndexDataName = $scop
导读angular$index获取ng-repeat的上一条数据: <div ng-repeat=item in dataList ng-click=func($index,$index-1)></div> $scope.func = function(thisIndex,preIndex){ var thisIndexDataName = $scope.dataList[thisIndex].dataName;//当前这条数据对应dataName var preIndexDataName = $scop

<div ng-repeat="item in dataList" ng-click="func($index,$index-1)"></div>
$scope.func = function(thisIndex,preIndex){
var thisIndexDataName = $scope.dataList[thisIndex].dataName;//当前这条数据对应dataName
var preIndexDataName = $scope.dataList[preIndex].dataName;//上一条数据里对应的dataName
}
?
angular$index获取ng-repeat的上一条数据
angular$index获取ng-repeat的上一条数据: <div ng-repeat=item in dataList ng-click=func($index,$index-1)></div> $scope.func = function(thisIndex,preIndex){ var thisIndexDataName = $scope.dataList[thisIndex].dataName;//当前这条数据对应dataName var preIndexDataName = $scop