Update
router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
<a [routerLink]="..." skipLocationChange>click me</a>
Update
There is a PR to support this directly https://github.com/angular/angular/pull/9608
Related issues
- https://github.com/angular/angular/issues/9579
- https://github.com/angular/angular/issues/9949
Original
You can implement a custom PlatformLocation similar to BrowserPlatformLocation but instead of calling ot history.pushState(), history.replaceState(), history.back(), and history.forward() maintain the changes in a local array.
You can then make Angular use your custom implementation by providing it like
bootstrap(AppComponent,
[provide(PlatformLocation, {useClass: MyPlatformLocation})]);