【发布时间】:2015-11-27 20:02:48
【问题描述】:
如何点击下一个按钮进入下一个项目,点击上一个按钮进入上一个项目?
重复显示数据库中的数据:
idSelectedShipment 是选定的 div 或货件 id
<div ng-repeat="shipment in shipments | orderBy:predicate:reverse">
<div ng-click="show_shipment($index,shipment.shipment_id)" ng-class="{selected_trip: shipment.shipment_id == idSelectedShipment}">
<div> From {{shipment.from_location}}</div>
</div>
</div>
下一个和上一个按钮:
<a class="" ng-click="next($event)" href="#">next</a>
<a class="" ng-click="previous($event)" href="#">previous</a>
我在这部分遇到了麻烦。下一个按钮和上一个按钮在 ng-repeat 之外,我似乎无法在点击时传递索引。
$scope.next= function(index){
[index + 1]
};
$scope.previous= function(index){
[index - 1]
};
【问题讨论】:
标签: javascript jquery angularjs