B contains a form. If the form is not filled in correctly, I’d like to prevent the user going back to A. However, they should still be allowed to go to C.
I thought about using ionViewCanLeave to prevent the user from going back to A, as this should also handle the user pressing the ‘Back’ button on Android. But, I need them to always be allowed to go to C. So, am I able to detect if the user is going ‘back’ or ‘forward’ in this lifecycle method?
You’d still use ionViewCanLeave to prevent the user from going back B -> A, but presenting a modal from B -> C will still work. Presenting a modal isn’t the same as pushing a whole new page to the nav stack.
I use this for complicated forms where I need the extra functionality of a modal that I can’t get from a typical select, prompt, or what have you.