ion-reorder-button
Child of ionItem
Usage
<ion-list ng-controller="MyCtrl" show-reorder="true">
<ion-item ng-repeat="item in items">
Item
<ion-reorder-button class="ion-navicon"
on-reorder="moveItem(item, $fromIndex, $toIndex)">
</ion-reorder-button>
</ion-item>
</ion-list>
function MyCtrl($scope) {
$scope.items = [1, 2, 3, 4];
$scope.moveItem = function(item, fromIndex, toIndex) {
//Move the item in the array
$scope.items.splice(fromIndex, 1);
$scope.items.splice(toIndex, 0, item);
};
}
API
Attr | Type | Details |
---|---|---|
on-reorder
(optional)
|
expression
|
Expression to call when an item is reordered. Parameters given: $fromIndex, $toIndex. |