javascript - How to delete an ion-list item using an ActionSheet? -


i need delete , item list (that populated array) using , actionsheet (trigger on-hold event) instead of standard ng-click.

the problem can't figure out how pass index numbre or item id locate , delete it.

here 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> 

and here controller actionsheet:

$scope.mostrarmenu = function(mensaje) {      // show 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;         }     }); }; 

any ideas?

i see using ng-repeat there can pass index $index

<ion-list>     <ion-item ng-repeat="mensaje in mensajes" class="item" ng-click="abrirmensaje()"      on-hold="mostrarmenu(mensaje, $index)">         <h2>{{ mensaje.alert }}</h2>         <p>{{ mensaje.hid }}</p>     </ion-item> </ion-list> 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -