How to remove history from stack in Ionic 4

#1

Hi everyone!

I’m working in a project Ionic/Angular and I need to remove the last router from stack when I press the hardware back button, however, I can’t find a way to do this. I noticed that in Ionic 3 there were some methods used to remove some pages from stack. I don’t want if I press back button it goes back to registration data page.

Is there a way to do that in Ionic 4?

1 Like
#2

pour suivre car ça m’interesse

#3

Hey, found anything since ?

1 Like
#4

Yes. I did! I started out using skipLocationChange from NavigationExtras, https://angular.io/api/router/NavigationExtras
But it wasn’t working as expected, it changed the page without changing the route. So, we found Location
that goes back on history. Take a look at it if you’re facing the same issue.

https://angular.io/api/common/Location

1 Like
#5

I will try it tonight, thanks !