feat(router_link): add skipLocationChange and replaceUrl inputs (#12850)
This commit is contained in:
parent
1b5384ee54
commit
46d150266b
|
@ -89,11 +89,13 @@ import {UrlTree} from '../url_tree';
|
||||||
*/
|
*/
|
||||||
@Directive({selector: ':not(a)[routerLink]'})
|
@Directive({selector: ':not(a)[routerLink]'})
|
||||||
export class RouterLink {
|
export class RouterLink {
|
||||||
private commands: any[] = [];
|
|
||||||
@Input() queryParams: {[k: string]: any};
|
@Input() queryParams: {[k: string]: any};
|
||||||
@Input() fragment: string;
|
@Input() fragment: string;
|
||||||
@Input() preserveQueryParams: boolean;
|
@Input() preserveQueryParams: boolean;
|
||||||
@Input() preserveFragment: boolean;
|
@Input() preserveFragment: boolean;
|
||||||
|
@Input() skipLocationChange: boolean;
|
||||||
|
@Input() replaceUrl: boolean;
|
||||||
|
private commands: any[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private router: Router, private route: ActivatedRoute,
|
private router: Router, private route: ActivatedRoute,
|
||||||
|
@ -120,7 +122,9 @@ export class RouterLink {
|
||||||
queryParams: this.queryParams,
|
queryParams: this.queryParams,
|
||||||
fragment: this.fragment,
|
fragment: this.fragment,
|
||||||
preserveQueryParams: toBool(this.preserveQueryParams),
|
preserveQueryParams: toBool(this.preserveQueryParams),
|
||||||
preserveFragment: toBool(this.preserveFragment)
|
preserveFragment: toBool(this.preserveFragment),
|
||||||
|
skipLocationChange: toBool(this.skipLocationChange),
|
||||||
|
replaceUrl: toBool(this.replaceUrl),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,12 +142,14 @@ export class RouterLink {
|
||||||
@Directive({selector: 'a[routerLink]'})
|
@Directive({selector: 'a[routerLink]'})
|
||||||
export class RouterLinkWithHref implements OnChanges, OnDestroy {
|
export class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||||
@Input() target: string;
|
@Input() target: string;
|
||||||
private commands: any[] = [];
|
|
||||||
@Input() queryParams: {[k: string]: any};
|
@Input() queryParams: {[k: string]: any};
|
||||||
@Input() fragment: string;
|
@Input() fragment: string;
|
||||||
@Input() routerLinkOptions: {preserveQueryParams: boolean, preserveFragment: boolean};
|
@Input() routerLinkOptions: {preserveQueryParams: boolean, preserveFragment: boolean};
|
||||||
@Input() preserveQueryParams: boolean;
|
@Input() preserveQueryParams: boolean;
|
||||||
@Input() preserveFragment: boolean;
|
@Input() preserveFragment: boolean;
|
||||||
|
@Input() skipLocationChange: boolean;
|
||||||
|
@Input() replaceUrl: boolean;
|
||||||
|
private commands: any[] = [];
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
|
|
||||||
// the url displayed on the anchor element.
|
// the url displayed on the anchor element.
|
||||||
|
@ -195,7 +201,9 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||||
queryParams: this.queryParams,
|
queryParams: this.queryParams,
|
||||||
fragment: this.fragment,
|
fragment: this.fragment,
|
||||||
preserveQueryParams: toBool(this.preserveQueryParams),
|
preserveQueryParams: toBool(this.preserveQueryParams),
|
||||||
preserveFragment: toBool(this.preserveFragment)
|
preserveFragment: toBool(this.preserveFragment),
|
||||||
|
skipLocationChange: toBool(this.skipLocationChange),
|
||||||
|
replaceUrl: toBool(this.replaceUrl),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,4 +211,4 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||||
function toBool(s?: any): boolean {
|
function toBool(s?: any): boolean {
|
||||||
if (s === '') return true;
|
if (s === '') return true;
|
||||||
return !!s;
|
return !!s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,9 @@ export declare class RouterLink {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
};
|
};
|
||||||
|
replaceUrl: boolean;
|
||||||
routerLink: any[] | string;
|
routerLink: any[] | string;
|
||||||
|
skipLocationChange: boolean;
|
||||||
urlTree: UrlTree;
|
urlTree: UrlTree;
|
||||||
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
||||||
onClick(): boolean;
|
onClick(): boolean;
|
||||||
|
@ -262,11 +264,13 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
[k: string]: any;
|
[k: string]: any;
|
||||||
};
|
};
|
||||||
|
replaceUrl: boolean;
|
||||||
routerLink: any[] | string;
|
routerLink: any[] | string;
|
||||||
routerLinkOptions: {
|
routerLinkOptions: {
|
||||||
preserveQueryParams: boolean;
|
preserveQueryParams: boolean;
|
||||||
preserveFragment: boolean;
|
preserveFragment: boolean;
|
||||||
};
|
};
|
||||||
|
skipLocationChange: boolean;
|
||||||
target: string;
|
target: string;
|
||||||
urlTree: UrlTree;
|
urlTree: UrlTree;
|
||||||
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
||||||
|
|
Loading…
Reference in New Issue