How to remove history from stack in Ionic 4

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

pour suivre car ça m’interesse

Hey, found anything since ?

1 Like

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

2 Likes

I will try it tonight, thanks !

kindly provide example code in ts

Did you find any solution, source code please?

Can you provide code example please