diff --git a/modules/@angular/router/src/directives/router_link.ts b/modules/@angular/router/src/directives/router_link.ts index 28f2bba0bf..3c382f7e22 100644 --- a/modules/@angular/router/src/directives/router_link.ts +++ b/modules/@angular/router/src/directives/router_link.ts @@ -102,7 +102,10 @@ export class RouterLink { @HostListener('click', []) onClick(): boolean { - const extras = {skipLocationChange: attrBoolValue(this.skipLocationChange)}; + const extras = { + skipLocationChange: attrBoolValue(this.skipLocationChange), + replaceUrl: attrBoolValue(this.replaceUrl), + }; this.router.navigateByUrl(this.urlTree, extras); return true; } @@ -114,7 +117,6 @@ export class RouterLink { fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserveQueryParams), preserveFragment: attrBoolValue(this.preserveFragment), - replaceUrl: attrBoolValue(this.replaceUrl), }); } } @@ -176,7 +178,10 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy { return true; } - const extras = {skipLocationChange: attrBoolValue(this.skipLocationChange)}; + const extras = { + skipLocationChange: attrBoolValue(this.skipLocationChange), + replaceUrl: attrBoolValue(this.replaceUrl), + }; this.router.navigateByUrl(this.urlTree, extras); return false; } @@ -192,7 +197,6 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy { fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserveQueryParams), preserveFragment: attrBoolValue(this.preserveFragment), - replaceUrl: attrBoolValue(this.replaceUrl), }); } } diff --git a/tools/public_api_guard/router/index.d.ts b/tools/public_api_guard/router/index.d.ts index 34c7c24333..77cd741d30 100644 --- a/tools/public_api_guard/router/index.d.ts +++ b/tools/public_api_guard/router/index.d.ts @@ -249,7 +249,7 @@ export declare class RouterLink { routerLink: any[] | string; skipLocationChange: boolean; urlTree: UrlTree; - constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy); + constructor(router: Router, route: ActivatedRoute); onClick(): boolean; } @@ -279,10 +279,6 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy { }; replaceUrl: boolean; routerLink: any[] | string; - routerLinkOptions: { - preserveQueryParams: boolean; - preserveFragment: boolean; - }; skipLocationChange: boolean; target: string; urlTree: UrlTree;