Ionic: Can't dismiss Alert when displayed after Confirm


#1

I want to show an alert box after a confirm box. For example, prompt the user for confirmation before deleting, and then show the result of the call to the web service.

In the example below, the first Alert.create is presented for the confirmation. If the user clicks Yes, then the web service call is made and then I show another Alert.create.

The problem is that the second alert cannot be dismissed.

I know I should wait for the first confirm to completely go away before showing the alert results, but I’m not sure how to do that correctly. Thoughts?


#2

Perhaps this comment might help?


#3

That did help. The trick was to create the confirm dialog as a variable outside the nav.present().

Then inside the ok click handler, call confirm.dismiss().then(…).

Working plunker here: http://plnkr.co/edit/8abBqnLpDs1Ql7Ibdixe?p=preview


#4

Hello i was using your solution but i keep getting property present does not exist on type navcontroller on present how did you fix that ?