I’m searching for a way to disable the hardware back button on certain pages, i.e. on a “loading” page; I know about the existence of
this.platform.backButton.subscribe(() => {
// do something here
});
, but this allows only for performing an action once the back button is pressed, but I don’t see how to cancel the “nav.pop()” action. Do you know how to achieve this?
Oh you are suggesting that was a workaround, I should in addition to subscribing to the back button, I should implement an ionViewCanLeave() in order to avoid the automatic back navigation?
Ok so I could confirm what I said above, there isn’t a ionViewCanLeave in v4, therefore you could not add a rule to tells the back action to be or not to be executed, but feel free to correct me if that’s wrong, that would be cool
In the meantime I may I have found, at least for my app, an ugly workaround. I want to override the back action because in my page there is a slider, so when the user click back, I don’t want to navigate back but I want to navigate to previous slide. The to so I subscribe to the platform.backButton in order to call slider.slidePrev()
Would love to see a “real” non hacky solution for this. I ran into this issue 5 minutes ago trying to show a pop up going like “Are you sure you dont want to save, bro ?”. Thought i could override it by putting a (tap) on the ion-back-button but no sigar