How to stop going back


#1

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 ?


#2

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: https://ionicframework.com/docs/v3/api/navigation/NavController/#setRoot.

I hope it can solve your problem :blush:


#3

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


#4

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