In my code, when I trigger the ionicPopup, upon button tap, it triggers another ionicPopup but it should close the previous ionicPopup. However, in my implementation, while it close the final ionicPopup, the initial ionicPopup doesnt close rather it hides which causes the app to freeze. Is there a way to make sure that all ionicPopups are closed or at least that they close each ionicpopup upon button tap. This is a codepen of my code http://codepen.io/anon/pen/dYVdJv
$scope.showPopup = function() {
$scope.data = {}
$ionicPopup.show({
title: ' Session Terminated!',
scope: $scope,
template:' You are currently logged into another device/browser. Pls log out from your other device/browser!',
buttons: [
{ text: '<h6 style="text-transform: capitalize;">Cancel</h6>',
type: 'button-positive'
},
{
text: '<h6 style="text-transform: capitalize;">Verify Me</h6>',
type: 'button-positive',
onTap: function(e) {
$scope.verifyMe();
}
}
]
}).then(function(res) {
console.log('Tapped!', res);
}, function(err) {
console.log('Err:', err);
}, function(popup) {
console.log('Got popup', popup);
$timeout(function() {
popup.close();
}, 1000);
});
};
$scope.verifyMe = function() {
$ionicPopup.show({
title: ' Enter Username',
scope: $scope,
template:'<input type="text" ng-model="user.username">',
buttons: [
{
text: '<h5 style="text-transform: capitalize;">Verify Me</h5>',
type: 'button-positive',
onTap: function(e) {
$scope.verifyNow('first.app');
}
}
]
}).then(function(res) {
console.log('Tapped!', res);
}, function(err) {
console.log('Err:', err);
}, function(popup) {
console.log('Got popup', popup);
$timeout(function() {
popup.close();
}, 1000);
});
};
$scope.verifyNow = function(username) {
console.log("verified and removed" + username)
}
once execution of code is complete, i get this when i check my code
<div class="popup-container popup-showing popup-hidden" ng-class="cssClass">
//more code here
</div>
this is actually the popup opened in the first ionicPopup.show({}), the second ionicPopup.show({}) gets closed. Dont know why the first one only gets hidden instead of closed.