ionViewWillLeave if from a tabbed page issues

In my app, I can block the user leaving a form if unsaved changes using ionViewWillLeave and then presenting an alert and returning false.

However, I then set the root page as a Tabbed page and now the same page that worked before (which is now a sub page of the tab) no longer blocks the pop. It still displays the alert but the page is popped anyway.

Is this a bug? Or do I need to present the Alert differently if within a tab page?

ionViewWillLeave() {
    let leave = this.allowLeave || !this.hasUnsavedChanges();
    if (!leave) {
        this.showConfirmallowLeaveAlert();
    }
    return leave;
}

private showConfirmallowLeaveAlert() {
    let confirmDismiss = Alert.create({
        subTitle: 'You have unsaved changes. Dismiss all your changes?',
        buttons: [
            {
                text: 'Cancel', handler: () => true
            },
            {
                text: 'Dismiss', handler: () => {
                    this.allowLeave = true;
                    confirmDismiss.dismiss().then(() => {
                        this.nav.pop();
                    })
                    return false;
                }
            }
        ]
    });
    this.nav.present(confirmDismiss);
}

Hi, Didn’t get you Point. But I think… You need to remove ConfirmDissmiss.dismiss() from From you confrim alert…

try:

  showConfirmallowLeaveAlert() {
  let confirmDismiss = Alert.create({
    subTitle: 'You have unsaved changes. Dismiss all your changes?',
    buttons: [
        {
            text: 'Cancel', handler: () => true
        },
        {
            text: 'Dismiss', 
            handler: () => {
                 this.allowLeave = true;
                 this.nav.pop();
                 
            }
        }
    ]
});
this.nav.present(confirmDismiss);