When using @angular/router (v4.4):
// navigates to 'home#abc'
router.navigate(["home"], { fragment: "abc" });
// navigates to 'home#abc'
router.navigateByUrl("/home#abc" });
// navigates to 'home' and ignores fragment
router.navigateByUrl("/home", { fragment: "abc" });
First 2 examples are ok but I would have expected that the third example also navigates to home#abc. I checked in angular's implementation that navigate first calls createUrlTree where extras.fragment is appended to url, however navigateByUrl simply ignores the fragment.
It would be surprising if this was a bug that no-one actually has reported yet. Still, I would like to have a confirmation that this is by design and not a bug. :)
Thanks!