2
votes

in Ionic 3 can override back button action by navbar.backButtonClick = ()=>{}

since navbar, navcontroller no longer exists in ionic 4

what is the similar why to override the ion-back-button back action

2

2 Answers

1
votes

You can use below code on your AppComponent class.

this.platform.backButton.subscribeWithPriority(9999, () => {
    // You decide what happens 
});
0
votes

My friend, this way it works.. android and ios hahaha

<ion-header>
    <ion-toolbar>

        <ion-buttons slot="start" style="position: relative;">
            <ion-back-button></ion-back-button>
            <div (click)="backButtonClick()" style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;background-color: transparent;z-index: 1000;"></div>
        </ion-buttons>

    </ion-toolbar>
</ion-header>