fix(router): do not finish bootstrap until all the routes are resolved (#14762)

DEPRECATION:

Use `RouterModule.forRoot(routes, {initialNavigation: 'enabled'})` instead of
`RouterModule.forRoot(routes, {initialNavigtaion: true})`.

Before doing this, move the initialization logic affecting the router
from the bootstrapped component to the boostrapped module.

Similarly, use `RouterModule.forRoot(routes, {initialNavigation: 'disabled'})`
instead of `RouterModule.forRoot(routes, {initialNavigation: false})`.

Deprecated options: 'legacy_enabled', `true` (same as 'legacy_enabled'),
'legacy_disabled', `false` (same as 'legacy_disabled').

The "Router Initial Navigation" design document covers this change.
Read more here:
https://docs.google.com/document/d/1Hlw1fPaVs-PCj5KPeJRKhrQGAvFOxdvTlwAcnZosu5A/edit?usp=sharing
This commit is contained in:
Victor Savkin
2017-03-07 17:27:20 -05:00
committed by Chuck Jazdzewski
parent 1cff1250ba
commit 5df998d086
13 changed files with 468 additions and 158 deletions

View File

@ -94,6 +94,9 @@ export declare class Location {
static stripTrailingSlash(url: string): string;
}
/** @experimental */
export declare const LOCATION_INITIALIZED: InjectionToken<Promise<any>>;
/** @experimental */
export interface LocationChangeEvent {
type: string;

View File

@ -93,6 +93,10 @@ export declare const WORKER_APP_LOCATION_PROVIDERS: ({
useFactory: (platformLocation: WebWorkerPlatformLocation, zone: NgZone) => () => Promise<boolean>;
multi: boolean;
deps: (typeof NgZone | typeof PlatformLocation)[];
} | {
provide: InjectionToken<Promise<any>>;
useFactory: (platformLocation: WebWorkerPlatformLocation) => Promise<any>;
deps: typeof PlatformLocation[];
})[];
/** @experimental */

View File

@ -76,7 +76,7 @@ export declare type Event = NavigationStart | NavigationEnd | NavigationCancel |
export interface ExtraOptions {
enableTracing?: boolean;
errorHandler?: ErrorHandler;
initialNavigation?: boolean;
initialNavigation?: InitialNavigation;
preloadingStrategy?: any;
useHash?: boolean;
}