1) Ionic's ListView object is <ion-list></ion-list>
2) Add and display the Edit button (same as add other custom buttons)
The Can-swipe property is set to True (the default is True), and an edit button is added to the Ion-item
<ion-list can-swipe= "true" > <ion-item ng-repeat= "item in lists" > {{item.name}} <ion-option-button class= "button-assertive" ng-click= "edit (item)" >Edit</ion-option-button> </ Ion-item></ion-list>
3) Add and Show Sort button
The Sort button has its own name, not with <ion-option-button></ion-option-button> the sort button is named: <ion-reorder-button></ Ion-reorder-button>
The use of the method is also very simple, ion-list the Show-reoder property is set to True, and then add a Sort button in the Ion-item.
<ion-list show-reorder= "true" > <ion-item ng-repeat= "item in lists" > {{item.name}} <ion-reorder-button class= "Ion-navicon" on-reorder= "MoveItem (item, $fromIndex, $toIndex)" ></ Ion-reorder-button> </ion-item></ion-list>
4) Add and Show Delete button
In the same way, the delete button is named:<ion-delete-button></ion-delete-button>
The use of the method is to set the Show-delete property to True on Ion-list, and then add a Delete button in Ion-item.
<ion-list show-Delete= "true" > <ion-item ng-repeat= "item in lists" > <ion-Delete -button class= "ion-minus-circled" ng-click= "Onitemdelete (item)" ></ion-delete-button> {{ Item.name}} </ion-item></ion-list>
PS1: The above said Show-reorder, Show-delete generally we will not be a list on the display, need to sort, delete operation to show the button, so Show-reorder, show-delete of course not directly write dead true/ False, you can use the $scope variable.
Example:
<ion-list show-Delete= "Data.showdelete" show-reorder= "Data.showreorder" ></ion-list>
PS2: The above On-reorder is a callback operation for the sort operation, and will be recalled every time the item's sort is changed, Ng-click Needless to say, a click event
PS3: Whether editing, sorting or deleting, is actually a data operation, changing the value of the data array can be, the following gives the official JS reference
function (item) { alert (' Edit item: ' +function(item, FromIndex, Toindex) { 1) ; 0function(item) { 1);};
The actual application, with the data of the database, not just the operation of the array is done, but it is only to write an asynchronous processing just a bit, and here is not to say
Official Document: http://ionicframework.com/docs/api/directive/ionList/
Ionic editing, sorting, and deleting a ListView object