fix(router): ensure routerLinkActive updates when associated routerLinks change (#38511)
This commit introduces a new subscription in the `routerLinkActive` directive which triggers an update when any of its associated routerLinks have changes. `RouterLinkActive` not only needs to know when links are added or removed, but it also needs to know about if a link it already knows about changes in some way. Quick note that `from...mergeAll` is used instead of just a simple `merge` (or `scheduled...mergeAll`) to avoid introducing new rxjs operators in order to keep bundle size down. Fixes #18469 PR Close #38511
This commit is contained in:
5
goldens/public-api/router/router.d.ts
vendored
5
goldens/public-api/router/router.d.ts
vendored
@ -378,7 +378,7 @@ export declare class RouterEvent {
|
||||
url: string);
|
||||
}
|
||||
|
||||
export declare class RouterLink {
|
||||
export declare class RouterLink implements OnChanges {
|
||||
fragment: string;
|
||||
preserveFragment: boolean;
|
||||
/** @deprecated */ set preserveQueryParams(value: boolean);
|
||||
@ -394,6 +394,7 @@ export declare class RouterLink {
|
||||
};
|
||||
get urlTree(): UrlTree;
|
||||
constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer2, el: ElementRef);
|
||||
ngOnChanges(changes: SimpleChanges): void;
|
||||
onClick(): boolean;
|
||||
}
|
||||
|
||||
@ -429,7 +430,7 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy {
|
||||
target: string;
|
||||
get urlTree(): UrlTree;
|
||||
constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy);
|
||||
ngOnChanges(changes: {}): any;
|
||||
ngOnChanges(changes: SimpleChanges): any;
|
||||
ngOnDestroy(): any;
|
||||
onClick(button: number, ctrlKey: boolean, metaKey: boolean, shiftKey: boolean): boolean;
|
||||
}
|
||||
|
Reference in New Issue
Block a user