1
我需要使用和ActionSheet(由等待事件觸發)而不是標準的ng-click來從列表中刪除項目(從數組填充)。如何使用ActionSheet刪除離子列表項目?
問題是,我不知道如何通過索引numbre或項目ID來找到它並刪除它。
下面是HTML:
<ion-list>
<ion-item ng-repeat="mensaje in mensajes" class="item" ng-click="abrirMensaje()"
on-hold="mostrarMenu(mensaje)">
<h2>{{ mensaje.alert }}</h2>
<p>{{ mensaje.hid }}</p>
</ion-item>
</ion-list>
這裏是爲ActionSheet控制器:
$scope.mostrarMenu = function(mensaje) {
// Show the action sheet
var hideSheet = $ionicActionSheet.show({
buttons: [
{ text: '<b>Compartir</b>' },
],
destructiveText: '<b>Eliminar</b>',
cancelText: '<b>Cancelar</b>',
cancel: function() {
},
buttonClicked: function(index) {
return true;
},
destructiveButtonClicked: function(mensaje) {
return true;
}
});
};
任何想法?