
To see this in action, I've put together a rather trite demo that passes full, hash-containing URLs into the location.go() method and then queries the location to see if the changes took place:

go() method to change the all three segments of the location path, including the fragment. And, in fact, if you treat the "path" argument as the entire application URL, omitting the "query" argument altogether, you can use the. Which means, the "path" argument should be able to contain the pathname, the query-string, and the hash. This means that if the "queryParams" argument is empty, "path" becomes the value that's passed to the underlying platform implementation. Let url = ( path + Location.normalizeQueryParams( queryParams ) ) Roughly speaking, the implementations look like this: If you look under the hood, however, you'll see that the LocationStrategy implementations in Angular ( Hash and Path) are simply normalizing and concatenating the path and the query-string before passing them through to the underlying platform location. After all, if we're breaking query-string apart from the path, then it would stand to reason there would also be a "hash" argument if the hash could be changed programmatically. To look at this, one would logically have to draw the conclusion that there is no way to change the hash or fragment portion of the application URL.

go() method with the following signature: The Location service in Angular 4.4 has a. Run this demo in my JavaScript Demos project on GitHub.
