How to stop going back


hi I am using ionic 4 and navigating to next pages using angular routing i have a sign in page when i run it in mobile and sign in it displays next page but when i press back button on my mobile it takes me back to log in page I want to disable going back to sign in page and only go back to sign in page when i press logout button which i already have set in my app … can anyone help ?


Maybe you could use nav.setRoot() so that you won’t be able to go back to your previous page. Here is a reference link:

I hope it can solve your problem :blush:


I have posted a question. Can you please help me out?


Look at using Angular’s routeguards to prevent navigation like this.