Reputation: 223
Lets say I navigate from page A --> B --> C
How can I remove page B from the navigation history so that when when I am on page C and press browser back it goes to page A?
Upvotes: 0
Views: 778
Reputation: 60518
You could try skipLocationChange.
// Navigate silently to /view (Component B)
this.router.navigate(['/view'], { skipLocationChange: true });
That navigates without pushing its state into history.
The docs for this is here: https://angular.io/docs/ts/latest/api/router/index/NavigationExtras-interface.html#!#skipLocationChange-anchor
Upvotes: 1
Reputation: 17869
I don't think Angular expose a public API to do it right now but if your app uses only a browser platform you can probably do it
window.history.go(-2);
Upvotes: 3