diff --git a/packages/router/src/index.ts b/packages/router/src/index.ts index f865efc88d..fbca9b2d5a 100644 --- a/packages/router/src/index.ts +++ b/packages/router/src/index.ts @@ -16,7 +16,7 @@ export {CanActivate, CanActivateChild, CanDeactivate, CanLoad, Resolve} from './ export {DetachedRouteHandle, RouteReuseStrategy} from './route_reuse_strategy'; export {Navigation, NavigationExtras, Router} from './router'; export {ROUTES} from './router_config_loader'; -export {ExtraOptions, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes} from './router_module'; +export {ExtraOptions, InitialNavigation, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes} from './router_module'; export {ChildrenOutletContexts, OutletContext} from './router_outlet_context'; export {NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader} from './router_preloader'; export {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot} from './router_state'; diff --git a/packages/router/src/router_module.ts b/packages/router/src/router_module.ts index 691a4be524..8ac49b6429 100644 --- a/packages/router/src/router_module.ts +++ b/packages/router/src/router_module.ts @@ -327,24 +327,24 @@ export interface ExtraOptions { * * ```typescript * class AppModule { - * constructor(router: Router, viewportScroller: ViewportScroller) { - * router.events.pipe( - * filter((e: Event): e is Scroll => e instanceof Scroll) - * ).subscribe(e => { - * if (e.position) { - * // backward navigation - * viewportScroller.scrollToPosition(e.position); - * } else if (e.anchor) { - * // anchor navigation - * viewportScroller.scrollToAnchor(e.anchor); - * } else { - * // forward navigation - * viewportScroller.scrollToPosition([0, 0]); - * } - * }); - * } - * } - * ``` + * constructor(router: Router, viewportScroller: ViewportScroller) { + * router.events.pipe( + * filter((e: Event): e is Scroll => e instanceof Scroll) + * ).subscribe(e => { + * if (e.position) { + * // backward navigation + * viewportScroller.scrollToPosition(e.position); + * } else if (e.anchor) { + * // anchor navigation + * viewportScroller.scrollToAnchor(e.anchor); + * } else { + * // forward navigation + * viewportScroller.scrollToPosition([0, 0]); + * } + * }); + * } + * } + * ``` */ scrollPositionRestoration?: 'disabled'|'enabled'|'top'; diff --git a/tools/public_api_guard/router/router.d.ts b/tools/public_api_guard/router/router.d.ts index 109e4536b4..48bd09e57d 100644 --- a/tools/public_api_guard/router/router.d.ts +++ b/tools/public_api_guard/router/router.d.ts @@ -148,6 +148,9 @@ export declare class GuardsCheckStart extends RouterEvent { toString(): string; } +/** @deprecated */ +export declare type InitialNavigation = true | false | 'enabled' | 'disabled' | 'legacy_enabled' | 'legacy_disabled'; + export declare type LoadChildren = LoadChildrenCallback | DeprecatedLoadChildren; export declare type LoadChildrenCallback = () => Type | NgModuleFactory | Observable> | Promise | Type | any>;