fix(router): respond to hashchange events

Previously if the URL changed in `HashLocation` mode, the router would not pick up the change.
This adds a listener in `HashLocationStrategy` for `hashchange` events to fix the problem.

Closes #5013
This commit is contained in:
Brian Ford
2015-10-30 08:48:47 -07:00
parent cb2b690471
commit 53bddec1d2
6 changed files with 95 additions and 0 deletions

View File

@ -63,6 +63,7 @@ export class PathLocationStrategy extends LocationStrategy {
onPopState(fn: EventListener): void {
DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false);
DOM.getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
}
getBaseHref(): string { return this._baseHref; }