docs(router): make `InitialNavigation` part of the public API (#32707)

`InitialNavigation` is used in `ExtraOptions`, which is already part of
the public API. Thus, `InitialNavigation` should be too. Not publicly
exporting it from `router/index.ts` seems an omission, since the type is
already annotated with the `@publicApi` JSDoc tag.

By publicly exporting `InitialNavigation`, it will also correctly appear
in the API docs on angular.io.

PR Close #32707
This commit is contained in:
George Kalpakas 2019-09-17 01:14:04 +03:00 committed by atscott
parent e41cbfb585
commit a23ee2b0a1
3 changed files with 22 additions and 19 deletions

View File

@ -16,7 +16,7 @@ export {CanActivate, CanActivateChild, CanDeactivate, CanLoad, Resolve} from './
export {DetachedRouteHandle, RouteReuseStrategy} from './route_reuse_strategy'; export {DetachedRouteHandle, RouteReuseStrategy} from './route_reuse_strategy';
export {Navigation, NavigationExtras, Router} from './router'; export {Navigation, NavigationExtras, Router} from './router';
export {ROUTES} from './router_config_loader'; 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 {ChildrenOutletContexts, OutletContext} from './router_outlet_context';
export {NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader} from './router_preloader'; export {NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader} from './router_preloader';
export {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot} from './router_state'; export {ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot} from './router_state';

View File

@ -327,24 +327,24 @@ export interface ExtraOptions {
* *
* ```typescript * ```typescript
* class AppModule { * class AppModule {
* constructor(router: Router, viewportScroller: ViewportScroller) { * constructor(router: Router, viewportScroller: ViewportScroller) {
* router.events.pipe( * router.events.pipe(
* filter((e: Event): e is Scroll => e instanceof Scroll) * filter((e: Event): e is Scroll => e instanceof Scroll)
* ).subscribe(e => { * ).subscribe(e => {
* if (e.position) { * if (e.position) {
* // backward navigation * // backward navigation
* viewportScroller.scrollToPosition(e.position); * viewportScroller.scrollToPosition(e.position);
* } else if (e.anchor) { * } else if (e.anchor) {
* // anchor navigation * // anchor navigation
* viewportScroller.scrollToAnchor(e.anchor); * viewportScroller.scrollToAnchor(e.anchor);
* } else { * } else {
* // forward navigation * // forward navigation
* viewportScroller.scrollToPosition([0, 0]); * viewportScroller.scrollToPosition([0, 0]);
* } * }
* }); * });
* } * }
* } * }
* ``` * ```
*/ */
scrollPositionRestoration?: 'disabled'|'enabled'|'top'; scrollPositionRestoration?: 'disabled'|'enabled'|'top';

View File

@ -148,6 +148,9 @@ export declare class GuardsCheckStart extends RouterEvent {
toString(): string; toString(): string;
} }
/** @deprecated */
export declare type InitialNavigation = true | false | 'enabled' | 'disabled' | 'legacy_enabled' | 'legacy_disabled';
export declare type LoadChildren = LoadChildrenCallback | DeprecatedLoadChildren; export declare type LoadChildren = LoadChildrenCallback | DeprecatedLoadChildren;
export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Observable<Type<any>> | Promise<NgModuleFactory<any> | Type<any> | any>; export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Observable<Type<any>> | Promise<NgModuleFactory<any> | Type<any> | any>;