Zsolt Z.
Zsolt Z.

Reputation: 599

How to prevent changing the url when returning false from canDactivate, when the navigation was triggered using the browser back button?

When the user presses the browser's back button, but the active component's canDeactivate method returns false, the user will stay on the page. However, the url that is shown is the one the user tried to navigate to. How can I make so that the url stays the same? And also the history stays the same.

Upvotes: 1

Views: 1377

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657967

This is a know issue and was fixed recently https://github.com/angular/angular/issues/10321

Update to the most recent version of Angular2 and the router should fix it.

Upvotes: 1

Related Questions