PR Close #20640
This commit is contained in:
parent
3aa7e0228a
commit
f791e9f081
|
@ -34,8 +34,6 @@ import {UrlSerializer, UrlTree, containsTree, createEmptyUrlTree} from './url_tr
|
|||
import {forEach} from './utils/collection';
|
||||
import {TreeNode, nodeChildrenAsMap} from './utils/tree';
|
||||
|
||||
declare let Zone: any;
|
||||
|
||||
/**
|
||||
* @whatItDoes Represents the extra options used during navigation.
|
||||
*
|
||||
|
@ -306,10 +304,11 @@ export class Router {
|
|||
* Sets up the location change listener.
|
||||
*/
|
||||
setUpLocationChangeListener(): void {
|
||||
// Zone.current.wrap is needed because of the issue with RxJS scheduler,
|
||||
// which does not work properly with zone.js in IE and Safari
|
||||
// Don't need to use Zone.wrap any more, because zone.js
|
||||
// already patch onPopState, so location change callback will
|
||||
// run into ngZone
|
||||
if (!this.locationSubscription) {
|
||||
this.locationSubscription = <any>this.location.subscribe(Zone.current.wrap((change: any) => {
|
||||
this.locationSubscription = <any>this.location.subscribe((change: any) => {
|
||||
const rawUrlTree = this.urlSerializer.parse(change['url']);
|
||||
const source: NavigationTrigger = change['type'] === 'popstate' ? 'popstate' : 'hashchange';
|
||||
const state = change.state && change.state.navigationId ?
|
||||
|
@ -317,7 +316,7 @@ export class Router {
|
|||
null;
|
||||
setTimeout(
|
||||
() => { this.scheduleNavigation(rawUrlTree, source, state, {replaceUrl: true}); }, 0);
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue