fix(router): ensure that page refresh with hash URLs works
This patch fixes the `HashLocationStrategy` to always return a string path value without a hash symbol as the starting value. Closes #2920
This commit is contained in:
parent
3f7ebde037
commit
c177d889a2
|
@ -20,7 +20,11 @@ export class HashLocationStrategy extends LocationStrategy {
|
|||
|
||||
getBaseHref(): string { return ''; }
|
||||
|
||||
path(): string { return this._location.hash; }
|
||||
path(): string {
|
||||
// the hash value is always prefixed with a `#`
|
||||
// and if it is empty then it will stay empty
|
||||
return this._location.hash.substr(1);
|
||||
}
|
||||
|
||||
pushState(state: any, title: string, url: string) {
|
||||
this._history.pushState(state, title, '#' + url);
|
||||
|
|
Loading…
Reference in New Issue