Browser does not know anything about the Angular routing. skipLocationChange
does what it says - it does not register a state change anywhere, not in the browser history either. If you go to '/b'
from '/a'
skipping the location change, browser still thinks you are on '/a'
. But you can try the following:
import { Location } from '@angular/common';
import { Router } from '@angular/router';
...
constructor(private location: Location, private router: Router) {}
...
// handle navigation not by routerLink, but manually inside your component:
public navigate(): void {
this.router.navigateByUrl('/articledetail', {skipLocationChange: true});
this.location.replaceState('/articledetail');
}
And in your html:
<a (click)="navigate()">Your title</a>
But I don't clearly see the point of this, because skipLocationChange
's purpose is to actually trick the browser into thinking that no state change has occurred.