@@ -218,24 +218,14 @@ export function provideRoutes(routes: Routes): any {
218
218
* The bootstrap is blocked until the initial navigation is complete.
219
219
* * 'disabled' - the initial navigation is not performed. The location listener is set up before
220
220
* the root component gets created.
221
- * * 'legacy_enabled'- the initial navigation starts after the root component has been created.
222
- * The bootstrap is not blocked until the initial navigation is complete. @deprecated
223
- * * 'legacy_disabled'- the initial navigation is not performed. The location listener is set up
224
- * after @deprecated
225
- * the root component gets created.
226
- * * `true` - same as 'legacy_enabled'. @deprecated since v4
227
- * * `false` - same as 'legacy_disabled'. @deprecated since v4
228
221
*
229
222
* The 'enabled' option should be used for applications unless there is a reason to have
230
223
* more control over when the router starts its initial navigation due to some complex
231
224
* initialization logic. In this case, 'disabled' should be used.
232
225
*
233
- * The 'legacy_enabled' and 'legacy_disabled' should not be used for new applications.
234
- *
235
226
* @experimental
236
227
*/
237
- export type InitialNavigation =
238
- true | false | 'enabled' | 'disabled' | 'legacy_enabled' | 'legacy_disabled' ;
228
+ export type InitialNavigation = 'enabled' | 'disabled' ;
239
229
240
230
/**
241
231
* @whatItDoes Represents options to configure the router.
@@ -254,7 +244,7 @@ export interface ExtraOptions {
254
244
useHash ?: boolean ;
255
245
256
246
/**
257
- * Disables the initial navigation.
247
+ * Enables/ Disables the initial navigation (enabled by default) .
258
248
*/
259
249
initialNavigation ?: InitialNavigation ;
260
250
@@ -332,14 +322,12 @@ export class RouterInitializer {
332
322
const router = this . injector . get ( Router ) ;
333
323
const opts = this . injector . get ( ROUTER_CONFIGURATION ) ;
334
324
335
- if ( this . isLegacyDisabled ( opts ) || this . isLegacyEnabled ( opts ) ) {
336
- resolve ( true ) ;
337
-
338
- } else if ( opts . initialNavigation === 'disabled' ) {
325
+ if ( opts . initialNavigation === 'disabled' ) {
339
326
router . setUpLocationChangeListener ( ) ;
340
327
resolve ( true ) ;
341
328
342
- } else if ( opts . initialNavigation === 'enabled' ) {
329
+ } else if (
330
+ opts . initialNavigation === 'enabled' || typeof opts . initialNavigation === 'undefined' ) {
343
331
router . hooks . afterPreactivation = ( ) => {
344
332
// only the initial navigation should be delayed
345
333
if ( ! this . initNavigation ) {
@@ -372,26 +360,11 @@ export class RouterInitializer {
372
360
return ;
373
361
}
374
362
375
- if ( this . isLegacyEnabled ( opts ) ) {
376
- router . initialNavigation ( ) ;
377
- } else if ( this . isLegacyDisabled ( opts ) ) {
378
- router . setUpLocationChangeListener ( ) ;
379
- }
380
-
381
363
preloader . setUpPreloading ( ) ;
382
364
router . resetRootComponentType ( ref . componentTypes [ 0 ] ) ;
383
365
this . resultOfPreactivationDone . next ( null ! ) ;
384
366
this . resultOfPreactivationDone . complete ( ) ;
385
367
}
386
-
387
- private isLegacyEnabled ( opts : ExtraOptions ) : boolean {
388
- return opts . initialNavigation === 'legacy_enabled' || opts . initialNavigation === true ||
389
- opts . initialNavigation === undefined ;
390
- }
391
-
392
- private isLegacyDisabled ( opts : ExtraOptions ) : boolean {
393
- return opts . initialNavigation === 'legacy_disabled' || opts . initialNavigation === false ;
394
- }
395
368
}
396
369
397
370
export function getAppInitializer ( r : RouterInitializer ) {
0 commit comments