AlertController or other xxxController bug [ionic2 version: beta.11]
` constructor(private nav: NavController,private alert:AlertController) {
showConfirm() { let confirm = this.alert.create({ title: 'Use this lightsaber?', message: 'Do you agree to use this lightsaber to do good across the intergalactic galaxy?', buttons: [ { text: 'Disagree', handler: () => { console.log('Disagree clicked'); } }, { text: 'Agree', handler: () => { this.nav.push(TabsPage); } } ] }); confirm.present(); }
`
I press 'Agree' go to TabsPage jump to TabsPage,but this confirm box is not hidden.other xxxController may also
As described in the AlertController docs in your handler you must
- FIRST dismiss your alert, THEN do your navigation
- return false
like
handler: () => {
confirm.dismiss().then(() => {
this.nav.pop();
});
return false;
}
Thanks for helping @szerner ! @feifeiwoye the solution above will fix your issue. Thanks for using Ionic!