feat(router): implement scrolling restoration service (#20030)

For documentation, see `RouterModule.scrollPositionRestoration`

Fixes #13636 #10929 #7791 #6595

PR Close #20030
This commit is contained in:
Victor Savkin
2018-05-17 07:33:50 -04:00
committed by Miško Hevery
parent 1b253e14ff
commit 49c5234c68
13 changed files with 662 additions and 11 deletions

View File

@ -108,15 +108,18 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
/** @experimental */
export declare type DetachedRouteHandle = {};
export declare type Event = RouterEvent | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivationStart | ChildActivationEnd | ActivationStart | ActivationEnd;
export declare type Event = RouterEvent | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivationStart | ChildActivationEnd | ActivationStart | ActivationEnd | Scroll;
export interface ExtraOptions {
anchorScrolling?: 'disabled' | 'enabled';
enableTracing?: boolean;
errorHandler?: ErrorHandler;
initialNavigation?: InitialNavigation;
onSameUrlNavigation?: 'reload' | 'ignore';
paramsInheritanceStrategy?: 'emptyOnly' | 'always';
preloadingStrategy?: any;
scrollOffset?: [number, number] | (() => [number, number]);
scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
useHash?: boolean;
}
@ -465,6 +468,17 @@ export declare class RoutesRecognized extends RouterEvent {
/** @experimental */
export declare type RunGuardsAndResolvers = 'paramsChange' | 'paramsOrQueryParamsChange' | 'always';
export declare class Scroll {
readonly anchor: string | null;
readonly position: [number, number] | null;
readonly routerEvent: NavigationEnd;
constructor(
routerEvent: NavigationEnd,
position: [number, number] | null,
anchor: string | null);
toString(): string;
}
/** @experimental */
export declare abstract class UrlHandlingStrategy {
abstract extract(url: UrlTree): UrlTree;