feat(router): add navigationSource and restoredState to NavigationStart event (#21728)
Currently, NavigationStart there is no way to know if an navigation was triggered imperatively or via the location change. These two use cases should be handled differently for a variety of use cases (e.g., scroll position restoration). This PR adds a navigation source field and restored navigation id (passed to navigations triggered by a URL change). PR Close #21728
This commit is contained in:
11
tools/public_api_guard/router/router.d.ts
vendored
11
tools/public_api_guard/router/router.d.ts
vendored
@ -208,6 +208,17 @@ export interface NavigationExtras {
|
||||
|
||||
/** @stable */
|
||||
export declare class NavigationStart extends RouterEvent {
|
||||
navigationTrigger?: 'imperative' | 'popstate' | 'hashchange';
|
||||
restoredState?: {
|
||||
navigationId: number;
|
||||
} | null;
|
||||
constructor(
|
||||
id: number,
|
||||
url: string,
|
||||
navigationTrigger?: 'imperative' | 'popstate' | 'hashchange',
|
||||
restoredState?: {
|
||||
navigationId: number;
|
||||
} | null);
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user