fix(router): fix replaceUrl on RouterLink directives

This commit is contained in:
Victor Berchet 2016-12-02 15:32:39 -08:00 committed by Alex Rickabaugh
parent f562cbf86c
commit 349ad75de3
2 changed files with 9 additions and 9 deletions

View File

@ -102,7 +102,10 @@ export class RouterLink {
@HostListener('click', []) @HostListener('click', [])
onClick(): boolean { onClick(): boolean {
const extras = {skipLocationChange: attrBoolValue(this.skipLocationChange)}; const extras = {
skipLocationChange: attrBoolValue(this.skipLocationChange),
replaceUrl: attrBoolValue(this.replaceUrl),
};
this.router.navigateByUrl(this.urlTree, extras); this.router.navigateByUrl(this.urlTree, extras);
return true; return true;
} }
@ -114,7 +117,6 @@ export class RouterLink {
fragment: this.fragment, fragment: this.fragment,
preserveQueryParams: attrBoolValue(this.preserveQueryParams), preserveQueryParams: attrBoolValue(this.preserveQueryParams),
preserveFragment: attrBoolValue(this.preserveFragment), preserveFragment: attrBoolValue(this.preserveFragment),
replaceUrl: attrBoolValue(this.replaceUrl),
}); });
} }
} }
@ -176,7 +178,10 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
return true; return true;
} }
const extras = {skipLocationChange: attrBoolValue(this.skipLocationChange)}; const extras = {
skipLocationChange: attrBoolValue(this.skipLocationChange),
replaceUrl: attrBoolValue(this.replaceUrl),
};
this.router.navigateByUrl(this.urlTree, extras); this.router.navigateByUrl(this.urlTree, extras);
return false; return false;
} }
@ -192,7 +197,6 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
fragment: this.fragment, fragment: this.fragment,
preserveQueryParams: attrBoolValue(this.preserveQueryParams), preserveQueryParams: attrBoolValue(this.preserveQueryParams),
preserveFragment: attrBoolValue(this.preserveFragment), preserveFragment: attrBoolValue(this.preserveFragment),
replaceUrl: attrBoolValue(this.replaceUrl),
}); });
} }
} }

View File

@ -249,7 +249,7 @@ export declare class RouterLink {
routerLink: any[] | string; routerLink: any[] | string;
skipLocationChange: boolean; skipLocationChange: boolean;
urlTree: UrlTree; urlTree: UrlTree;
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy); constructor(router: Router, route: ActivatedRoute);
onClick(): boolean; onClick(): boolean;
} }
@ -279,10 +279,6 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
}; };
replaceUrl: boolean; replaceUrl: boolean;
routerLink: any[] | string; routerLink: any[] | string;
routerLinkOptions: {
preserveQueryParams: boolean;
preserveFragment: boolean;
};
skipLocationChange: boolean; skipLocationChange: boolean;
target: string; target: string;
urlTree: UrlTree; urlTree: UrlTree;