How to resolve showConfirm popup?

Hi,

i’m really new (2 weeks) into html an js prog… i’m sure its really easy but i can’t understand how to resolve the popup.
I have a button to delete an item into itemlist, i use this command and its work well :smile:

scope.deleteContact = function(friend) {
$scope.friendlist.splice($scope.friendlist.indexOf(friend), 1);
};

now i put a “showConfirm popup” for validate, how i tell the showconfirm to delete if its resolve ?

$scope.showConfirm = function() {
var confirmPopup = $ionicPopup.confirm({
title: ‘Delete Contact’,
template: ‘Are you sure you want to kick him from your contact-list?’,
cancelText: ‘Nop’,
cancelType: ‘button-cancel’,
okText: ‘sure’,
okType: ‘button-default’,
});

confirmPopup.then(function(res) {
  if(res) {

// i think its here, but how ?

  ;
  } else {
    console.log('You are not sure');
  }

});
};

thanks for helping :blush:

confirmPopup.then(function(res) {
  if(res) {
     $scope.deleteContact();
  } else {
    console.log('You are not sure');
  }
});

This should do :wink:

1 Like

awsome it works thx !! :smile:

1 Like