Angular2 router causes an extra entry in browser history

In Angular2, I want to be able to go directly to the route and be able to hit (in the browser) once to go to the last page that I was on.

If you go to any site first (I used google.com), then put this plnkr in your browser bar: http://run.plnkr.co/9D5IDnHv0UkUFM82/ . If you click the back button of the browser, instead of transferring you to the previous page, it keeps you on plnkr until you drop it back.

I believe this is because although I went directly to the "home" route, when I clicked http://run.plnkr.co/9D5IDnHv0UkUFM82/ (note that I set the base url to / 9D5IDnHv0UkUFM82 /), it redirects me to the home URL, although I'm already there.

This problem also occurs in the Angular2 Tutorial application: https://angular.io/resources/live-examples/toh-5/ts/plnkr.html

Please note that when loading a route, there is an additional entry in the browser history. You can click back in your browser and it will remain on plnkr until you click back again. This is not an artifact caused by plnkr. This also happens in a local installation of Angular2.

0
source share
1 answer

This is a known issue.

See also
- https://github.com/angular/angular/issues/5025

Already have a transfer request
- https://github.com/angular/angular/pull/6069

+1
source

All Articles