@angular/router 13.0.0-next.8 → 13.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  2. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  3. package/esm2020/router.mjs +5 -0
  4. package/{esm2015/src/apply_redirects.js → esm2020/src/apply_redirects.mjs} +0 -0
  5. package/esm2020/src/components/empty_outlet.mjs +29 -0
  6. package/esm2020/src/config.mjs +14 -0
  7. package/esm2020/src/create_router_state.mjs +52 -0
  8. package/{esm2015/src/create_url_tree.js → esm2020/src/create_url_tree.mjs} +0 -0
  9. package/esm2020/src/directives/router_link.mjs +353 -0
  10. package/esm2020/src/directives/router_link_active.mjs +215 -0
  11. package/esm2020/src/directives/router_outlet.mjs +219 -0
  12. package/{esm2015/src/events.js → esm2020/src/events.mjs} +0 -0
  13. package/{esm2015/src/index.js → esm2020/src/index.mjs} +1 -1
  14. package/{esm2015/src/interfaces.js → esm2020/src/interfaces.mjs} +1 -1
  15. package/{esm2015/src/operators/activate_routes.js → esm2020/src/operators/activate_routes.mjs} +8 -6
  16. package/esm2020/src/operators/apply_redirects.mjs +14 -0
  17. package/esm2020/src/operators/check_guards.mjs +138 -0
  18. package/{esm2015/src/operators/prioritized_guard_value.js → esm2020/src/operators/prioritized_guard_value.mjs} +0 -0
  19. package/esm2020/src/operators/recognize.mjs +14 -0
  20. package/esm2020/src/operators/resolve_data.mjs +59 -0
  21. package/{esm2015/src/operators/switch_tap.js → esm2020/src/operators/switch_tap.mjs} +0 -0
  22. package/{esm2015/src/private_export.js → esm2020/src/private_export.mjs} +0 -0
  23. package/esm2020/src/recognize.mjs +262 -0
  24. package/{esm2015/src/route_reuse_strategy.js → esm2020/src/route_reuse_strategy.mjs} +0 -0
  25. package/esm2020/src/router.mjs +1002 -0
  26. package/esm2020/src/router_config_loader.mjs +71 -0
  27. package/esm2020/src/router_module.mjs +370 -0
  28. package/esm2020/src/router_outlet_context.mjs +74 -0
  29. package/esm2020/src/router_preloader.mjs +127 -0
  30. package/esm2020/src/router_scroller.mjs +95 -0
  31. package/esm2020/src/router_state.mjs +404 -0
  32. package/{esm2015/src/shared.js → esm2020/src/shared.mjs} +0 -0
  33. package/{esm2015/src/url_handling_strategy.js → esm2020/src/url_handling_strategy.mjs} +0 -0
  34. package/{esm2015/src/url_tree.js → esm2020/src/url_tree.mjs} +0 -0
  35. package/{esm2015/src/utils/collection.js → esm2020/src/utils/collection.mjs} +0 -0
  36. package/{esm2015/src/utils/config.js → esm2020/src/utils/config.mjs} +2 -2
  37. package/esm2020/src/utils/config_matching.mjs +145 -0
  38. package/{esm2015/src/utils/preactivation.js → esm2020/src/utils/preactivation.mjs} +0 -0
  39. package/{esm2015/src/utils/tree.js → esm2020/src/utils/tree.mjs} +0 -0
  40. package/{esm2015/src/utils/type_guards.js → esm2020/src/utils/type_guards.mjs} +0 -0
  41. package/{esm2015/src/version.js → esm2020/src/version.mjs} +1 -1
  42. package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
  43. package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
  44. package/esm2020/testing/src/extra_router_testing_providers.mjs +10 -0
  45. package/esm2020/testing/src/router_testing_module.mjs +122 -0
  46. package/esm2020/testing/src/spy_ng_module_factory_loader.mjs +10 -0
  47. package/esm2020/testing/src/testing.mjs +15 -0
  48. package/{esm2015/testing/testing.js → esm2020/testing/testing.mjs} +0 -0
  49. package/{esm2015/upgrade/index.js → esm2020/upgrade/index.mjs} +0 -0
  50. package/{esm2015/upgrade/public_api.js → esm2020/upgrade/public_api.mjs} +0 -0
  51. package/esm2020/upgrade/src/upgrade.mjs +120 -0
  52. package/{esm2015/upgrade/upgrade.js → esm2020/upgrade/upgrade.mjs} +0 -0
  53. package/fesm2015/{router.js → router.mjs} +541 -535
  54. package/fesm2015/router.mjs.map +1 -0
  55. package/fesm2015/testing.mjs +179 -0
  56. package/fesm2015/testing.mjs.map +1 -0
  57. package/fesm2015/{upgrade.js → upgrade.mjs} +4 -5
  58. package/fesm2015/upgrade.mjs.map +1 -0
  59. package/fesm2020/router.mjs +6150 -0
  60. package/fesm2020/router.mjs.map +1 -0
  61. package/fesm2020/testing.mjs +179 -0
  62. package/fesm2020/testing.mjs.map +1 -0
  63. package/fesm2020/upgrade.mjs +150 -0
  64. package/fesm2020/upgrade.mjs.map +1 -0
  65. package/package.json +41 -11
  66. package/router.d.ts +117 -117
  67. package/testing/package.json +5 -5
  68. package/testing/testing.d.ts +9 -66
  69. package/upgrade/package.json +5 -5
  70. package/upgrade/upgrade.d.ts +1 -1
  71. package/bundles/router-testing.umd.js +0 -541
  72. package/bundles/router-testing.umd.js.map +0 -1
  73. package/bundles/router-upgrade.umd.js +0 -157
  74. package/bundles/router-upgrade.umd.js.map +0 -1
  75. package/bundles/router.umd.js +0 -6867
  76. package/bundles/router.umd.js.map +0 -1
  77. package/esm2015/router.externs.js +0 -6
  78. package/esm2015/router.js +0 -9
  79. package/esm2015/src/components/empty_outlet.js +0 -24
  80. package/esm2015/src/config.js +0 -14
  81. package/esm2015/src/create_router_state.js +0 -63
  82. package/esm2015/src/directives/router_link.js +0 -328
  83. package/esm2015/src/directives/router_link_active.js +0 -210
  84. package/esm2015/src/directives/router_outlet.js +0 -193
  85. package/esm2015/src/operators/apply_redirects.js +0 -14
  86. package/esm2015/src/operators/check_guards.js +0 -138
  87. package/esm2015/src/operators/recognize.js +0 -14
  88. package/esm2015/src/operators/resolve_data.js +0 -56
  89. package/esm2015/src/recognize.js +0 -262
  90. package/esm2015/src/router.js +0 -1012
  91. package/esm2015/src/router_config_loader.js +0 -76
  92. package/esm2015/src/router_module.js +0 -363
  93. package/esm2015/src/router_outlet_context.js +0 -73
  94. package/esm2015/src/router_preloader.js +0 -130
  95. package/esm2015/src/router_scroller.js +0 -95
  96. package/esm2015/src/router_state.js +0 -404
  97. package/esm2015/src/utils/config_matching.js +0 -145
  98. package/esm2015/testing/src/router_testing_module.js +0 -166
  99. package/esm2015/testing/src/testing.js +0 -14
  100. package/esm2015/testing/testing.externs.js +0 -6
  101. package/esm2015/upgrade/src/upgrade.js +0 -122
  102. package/esm2015/upgrade/upgrade.externs.js +0 -6
  103. package/fesm2015/router.js.map +0 -1
  104. package/fesm2015/testing.js +0 -204
  105. package/fesm2015/testing.js.map +0 -1
  106. package/fesm2015/upgrade.js.map +0 -1
  107. package/router.metadata.json +0 -1
  108. package/testing/testing.metadata.json +0 -1
  109. package/testing.d.ts +0 -7
  110. package/testing.metadata.json +0 -1
  111. package/upgrade/upgrade.metadata.json +0 -1
  112. package/upgrade.d.ts +0 -7
  113. package/upgrade.metadata.json +0 -1
@@ -1,13 +1,15 @@
1
1
  /**
2
- * @license Angular v13.0.0-next.8
2
+ * @license Angular v13.0.0-rc.2
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { Location, LocationStrategy, ViewportScroller, PlatformLocation, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
8
- import { ɵisObservable, ɵisPromise, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable, Type, Injector, NgModuleFactoryLoader, Compiler, Directive, Attribute, Renderer2, ElementRef, Input, HostListener, HostBinding, EventEmitter, ChangeDetectorRef, Optional, ContentChildren, Output, ViewContainerRef, ComponentFactoryResolver, SystemJsNgModuleLoader, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
7
+ import * as i0 from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, NgModuleRef, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, Injectable, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
9
9
  import { from, of, BehaviorSubject, combineLatest, Observable, EmptyError, concat, defer, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, refCount, finalize, mergeAll } from 'rxjs/operators';
11
+ import * as i3 from '@angular/common';
12
+ import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
11
13
 
12
14
  /**
13
15
  * @license
@@ -1677,7 +1679,8 @@ function createNode(routeReuseStrategy, curr, prevState) {
1677
1679
  const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
1678
1680
  if (detachedRouteHandle !== null) {
1679
1681
  const tree = detachedRouteHandle.route;
1680
- setFutureSnapshotsOfActivatedRoutes(curr, tree);
1682
+ tree.value._futureSnapshot = curr.value;
1683
+ tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));
1681
1684
  return tree;
1682
1685
  }
1683
1686
  }
@@ -1686,18 +1689,6 @@ function createNode(routeReuseStrategy, curr, prevState) {
1686
1689
  return new TreeNode(value, children);
1687
1690
  }
1688
1691
  }
1689
- function setFutureSnapshotsOfActivatedRoutes(curr, result) {
1690
- if (curr.value.routeConfig !== result.value.routeConfig) {
1691
- throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route');
1692
- }
1693
- if (curr.children.length !== result.children.length) {
1694
- throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children');
1695
- }
1696
- result.value._futureSnapshot = curr.value;
1697
- for (let i = 0; i < curr.children.length; ++i) {
1698
- setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]);
1699
- }
1700
- }
1701
1692
  function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
1702
1693
  return curr.children.map(child => {
1703
1694
  for (const p of prevState.children) {
@@ -2079,6 +2070,11 @@ class ActivateRoutes {
2079
2070
  }
2080
2071
  detachAndStoreRouteSubtree(route, parentContexts) {
2081
2072
  const context = parentContexts.getContext(route.value.outlet);
2073
+ const contexts = context && route.value.component ? context.children : parentContexts;
2074
+ const children = nodeChildrenAsMap(route);
2075
+ for (const childOutlet of Object.keys(children)) {
2076
+ this.deactivateRouteAndItsChildren(children[childOutlet], contexts);
2077
+ }
2082
2078
  if (context && context.outlet) {
2083
2079
  const componentRef = context.outlet.detach();
2084
2080
  const contexts = context.children.onOutletDeactivated();
@@ -2147,7 +2143,8 @@ class ActivateRoutes {
2147
2143
  // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated
2148
2144
  context.outlet.attach(stored.componentRef, stored.route.value);
2149
2145
  }
2150
- advanceActivatedRouteNodeAndItsChildren(stored.route);
2146
+ advanceActivatedRoute(stored.route.value);
2147
+ this.activateChildRoutes(futureNode, null, context.children);
2151
2148
  }
2152
2149
  else {
2153
2150
  const config = parentLoadedConfig(future.snapshot);
@@ -2170,10 +2167,6 @@ class ActivateRoutes {
2170
2167
  }
2171
2168
  }
2172
2169
  }
2173
- function advanceActivatedRouteNodeAndItsChildren(node) {
2174
- advanceActivatedRoute(node.value);
2175
- node.children.forEach(advanceActivatedRouteNodeAndItsChildren);
2176
- }
2177
2170
  function parentLoadedConfig(snapshot) {
2178
2171
  for (let s = snapshot.parent; s; s = s.parent) {
2179
2172
  const route = s.routeConfig;
@@ -2280,6 +2273,295 @@ function prioritizedGuardValue() {
2280
2273
  });
2281
2274
  }
2282
2275
 
2276
+ /**
2277
+ * @license
2278
+ * Copyright Google LLC All Rights Reserved.
2279
+ *
2280
+ * Use of this source code is governed by an MIT-style license that can be
2281
+ * found in the LICENSE file at https://angular.io/license
2282
+ */
2283
+ /**
2284
+ * Store contextual information about a `RouterOutlet`
2285
+ *
2286
+ * @publicApi
2287
+ */
2288
+ class OutletContext {
2289
+ constructor() {
2290
+ this.outlet = null;
2291
+ this.route = null;
2292
+ this.resolver = null;
2293
+ this.children = new ChildrenOutletContexts();
2294
+ this.attachRef = null;
2295
+ }
2296
+ }
2297
+ /**
2298
+ * Store contextual information about the children (= nested) `RouterOutlet`
2299
+ *
2300
+ * @publicApi
2301
+ */
2302
+ class ChildrenOutletContexts {
2303
+ constructor() {
2304
+ // contexts for child outlets, by name.
2305
+ this.contexts = new Map();
2306
+ }
2307
+ /** Called when a `RouterOutlet` directive is instantiated */
2308
+ onChildOutletCreated(childName, outlet) {
2309
+ const context = this.getOrCreateContext(childName);
2310
+ context.outlet = outlet;
2311
+ this.contexts.set(childName, context);
2312
+ }
2313
+ /**
2314
+ * Called when a `RouterOutlet` directive is destroyed.
2315
+ * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
2316
+ * re-created later.
2317
+ */
2318
+ onChildOutletDestroyed(childName) {
2319
+ const context = this.getContext(childName);
2320
+ if (context) {
2321
+ context.outlet = null;
2322
+ context.attachRef = null;
2323
+ }
2324
+ }
2325
+ /**
2326
+ * Called when the corresponding route is deactivated during navigation.
2327
+ * Because the component get destroyed, all children outlet are destroyed.
2328
+ */
2329
+ onOutletDeactivated() {
2330
+ const contexts = this.contexts;
2331
+ this.contexts = new Map();
2332
+ return contexts;
2333
+ }
2334
+ onOutletReAttached(contexts) {
2335
+ this.contexts = contexts;
2336
+ }
2337
+ getOrCreateContext(childName) {
2338
+ let context = this.getContext(childName);
2339
+ if (!context) {
2340
+ context = new OutletContext();
2341
+ this.contexts.set(childName, context);
2342
+ }
2343
+ return context;
2344
+ }
2345
+ getContext(childName) {
2346
+ return this.contexts.get(childName) || null;
2347
+ }
2348
+ }
2349
+
2350
+ /**
2351
+ * @license
2352
+ * Copyright Google LLC All Rights Reserved.
2353
+ *
2354
+ * Use of this source code is governed by an MIT-style license that can be
2355
+ * found in the LICENSE file at https://angular.io/license
2356
+ */
2357
+ /**
2358
+ * @description
2359
+ *
2360
+ * Acts as a placeholder that Angular dynamically fills based on the current router state.
2361
+ *
2362
+ * Each outlet can have a unique name, determined by the optional `name` attribute.
2363
+ * The name cannot be set or changed dynamically. If not set, default value is "primary".
2364
+ *
2365
+ * ```
2366
+ * <router-outlet></router-outlet>
2367
+ * <router-outlet name='left'></router-outlet>
2368
+ * <router-outlet name='right'></router-outlet>
2369
+ * ```
2370
+ *
2371
+ * Named outlets can be the targets of secondary routes.
2372
+ * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:
2373
+ *
2374
+ * `{path: <base-path>, component: <component>, outlet: <target_outlet_name>}`
2375
+ *
2376
+ * Using named outlets and secondary routes, you can target multiple outlets in
2377
+ * the same `RouterLink` directive.
2378
+ *
2379
+ * The router keeps track of separate branches in a navigation tree for each named outlet and
2380
+ * generates a representation of that tree in the URL.
2381
+ * The URL for a secondary route uses the following syntax to specify both the primary and secondary
2382
+ * routes at the same time:
2383
+ *
2384
+ * `http://base-path/primary-route-path(outlet-name:route-path)`
2385
+ *
2386
+ * A router outlet emits an activate event when a new component is instantiated,
2387
+ * deactivate event when a component is destroyed.
2388
+ * An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the
2389
+ * subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to
2390
+ * detach the subtree.
2391
+ *
2392
+ * ```
2393
+ * <router-outlet
2394
+ * (activate)='onActivate($event)'
2395
+ * (deactivate)='onDeactivate($event)'
2396
+ * (attach)='onAttach($event)'
2397
+ * (detach)='onDetach($event)'></router-outlet>
2398
+ * ```
2399
+ *
2400
+ * @see [Routing tutorial](guide/router-tutorial-toh#named-outlets "Example of a named
2401
+ * outlet and secondary route configuration").
2402
+ * @see `RouterLink`
2403
+ * @see `Route`
2404
+ * @ngModule RouterModule
2405
+ *
2406
+ * @publicApi
2407
+ */
2408
+ class RouterOutlet {
2409
+ constructor(parentContexts, location, resolver, name, changeDetector) {
2410
+ this.parentContexts = parentContexts;
2411
+ this.location = location;
2412
+ this.resolver = resolver;
2413
+ this.changeDetector = changeDetector;
2414
+ this.activated = null;
2415
+ this._activatedRoute = null;
2416
+ this.activateEvents = new EventEmitter();
2417
+ this.deactivateEvents = new EventEmitter();
2418
+ /**
2419
+ * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
2420
+ * previously detached subtree.
2421
+ **/
2422
+ this.attachEvents = new EventEmitter();
2423
+ /**
2424
+ * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
2425
+ * subtree.
2426
+ */
2427
+ this.detachEvents = new EventEmitter();
2428
+ this.name = name || PRIMARY_OUTLET;
2429
+ parentContexts.onChildOutletCreated(this.name, this);
2430
+ }
2431
+ /** @nodoc */
2432
+ ngOnDestroy() {
2433
+ this.parentContexts.onChildOutletDestroyed(this.name);
2434
+ }
2435
+ /** @nodoc */
2436
+ ngOnInit() {
2437
+ if (!this.activated) {
2438
+ // If the outlet was not instantiated at the time the route got activated we need to populate
2439
+ // the outlet when it is initialized (ie inside a NgIf)
2440
+ const context = this.parentContexts.getContext(this.name);
2441
+ if (context && context.route) {
2442
+ if (context.attachRef) {
2443
+ // `attachRef` is populated when there is an existing component to mount
2444
+ this.attach(context.attachRef, context.route);
2445
+ }
2446
+ else {
2447
+ // otherwise the component defined in the configuration is created
2448
+ this.activateWith(context.route, context.resolver || null);
2449
+ }
2450
+ }
2451
+ }
2452
+ }
2453
+ get isActivated() {
2454
+ return !!this.activated;
2455
+ }
2456
+ /**
2457
+ * @returns The currently activated component instance.
2458
+ * @throws An error if the outlet is not activated.
2459
+ */
2460
+ get component() {
2461
+ if (!this.activated)
2462
+ throw new Error('Outlet is not activated');
2463
+ return this.activated.instance;
2464
+ }
2465
+ get activatedRoute() {
2466
+ if (!this.activated)
2467
+ throw new Error('Outlet is not activated');
2468
+ return this._activatedRoute;
2469
+ }
2470
+ get activatedRouteData() {
2471
+ if (this._activatedRoute) {
2472
+ return this._activatedRoute.snapshot.data;
2473
+ }
2474
+ return {};
2475
+ }
2476
+ /**
2477
+ * Called when the `RouteReuseStrategy` instructs to detach the subtree
2478
+ */
2479
+ detach() {
2480
+ if (!this.activated)
2481
+ throw new Error('Outlet is not activated');
2482
+ this.location.detach();
2483
+ const cmp = this.activated;
2484
+ this.activated = null;
2485
+ this._activatedRoute = null;
2486
+ this.detachEvents.emit(cmp.instance);
2487
+ return cmp;
2488
+ }
2489
+ /**
2490
+ * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
2491
+ */
2492
+ attach(ref, activatedRoute) {
2493
+ this.activated = ref;
2494
+ this._activatedRoute = activatedRoute;
2495
+ this.location.insert(ref.hostView);
2496
+ this.attachEvents.emit(ref.instance);
2497
+ }
2498
+ deactivate() {
2499
+ if (this.activated) {
2500
+ const c = this.component;
2501
+ this.activated.destroy();
2502
+ this.activated = null;
2503
+ this._activatedRoute = null;
2504
+ this.deactivateEvents.emit(c);
2505
+ }
2506
+ }
2507
+ activateWith(activatedRoute, resolver) {
2508
+ if (this.isActivated) {
2509
+ throw new Error('Cannot activate an already activated outlet');
2510
+ }
2511
+ this._activatedRoute = activatedRoute;
2512
+ const snapshot = activatedRoute._futureSnapshot;
2513
+ const component = snapshot.routeConfig.component;
2514
+ resolver = resolver || this.resolver;
2515
+ const factory = resolver.resolveComponentFactory(component);
2516
+ const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
2517
+ const injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
2518
+ this.activated = this.location.createComponent(factory, this.location.length, injector);
2519
+ // Calling `markForCheck` to make sure we will run the change detection when the
2520
+ // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
2521
+ this.changeDetector.markForCheck();
2522
+ this.activateEvents.emit(this.activated.instance);
2523
+ }
2524
+ }
2525
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: i0.ComponentFactoryResolver }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2526
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.2", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2527
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterOutlet, decorators: [{
2528
+ type: Directive,
2529
+ args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2530
+ }], ctorParameters: function () {
2531
+ return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
2532
+ type: Attribute,
2533
+ args: ['name']
2534
+ }] }, { type: i0.ChangeDetectorRef }];
2535
+ }, propDecorators: { activateEvents: [{
2536
+ type: Output,
2537
+ args: ['activate']
2538
+ }], deactivateEvents: [{
2539
+ type: Output,
2540
+ args: ['deactivate']
2541
+ }], attachEvents: [{
2542
+ type: Output,
2543
+ args: ['attach']
2544
+ }], detachEvents: [{
2545
+ type: Output,
2546
+ args: ['detach']
2547
+ }] } });
2548
+ class OutletInjector {
2549
+ constructor(route, childContexts, parent) {
2550
+ this.route = route;
2551
+ this.childContexts = childContexts;
2552
+ this.parent = parent;
2553
+ }
2554
+ get(token, notFoundValue) {
2555
+ if (token === ActivatedRoute) {
2556
+ return this.route;
2557
+ }
2558
+ if (token === ChildrenOutletContexts) {
2559
+ return this.childContexts;
2560
+ }
2561
+ return this.parent.get(token, notFoundValue);
2562
+ }
2563
+ }
2564
+
2283
2565
  /**
2284
2566
  * @license
2285
2567
  * Copyright Google LLC All Rights Reserved.
@@ -2298,9 +2580,12 @@ function prioritizedGuardValue() {
2298
2580
  */
2299
2581
  class ɵEmptyOutletComponent {
2300
2582
  }
2301
- ɵEmptyOutletComponent.decorators = [
2302
- { type: Component, args: [{ template: `<router-outlet></router-outlet>` },] }
2303
- ];
2583
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2584
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0-rc.2", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, directives: [{ type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2586
+ type: Component,
2587
+ args: [{ template: `<router-outlet></router-outlet>` }]
2588
+ }] });
2304
2589
 
2305
2590
  /**
2306
2591
  * @license
@@ -2428,7 +2713,7 @@ function sortByMatchingOutlets(routes, outletName) {
2428
2713
  * Use of this source code is governed by an MIT-style license that can be
2429
2714
  * found in the LICENSE file at https://angular.io/license
2430
2715
  */
2431
- const noMatch = {
2716
+ const noMatch$1 = {
2432
2717
  matched: false,
2433
2718
  consumedSegments: [],
2434
2719
  lastChild: 0,
@@ -2439,7 +2724,7 @@ function match(segmentGroup, route, segments) {
2439
2724
  var _a;
2440
2725
  if (route.path === '') {
2441
2726
  if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
2442
- return Object.assign({}, noMatch);
2727
+ return Object.assign({}, noMatch$1);
2443
2728
  }
2444
2729
  return {
2445
2730
  matched: true,
@@ -2452,7 +2737,7 @@ function match(segmentGroup, route, segments) {
2452
2737
  const matcher = route.matcher || defaultUrlMatcher;
2453
2738
  const res = matcher(segments, segmentGroup, route);
2454
2739
  if (!res)
2455
- return Object.assign({}, noMatch);
2740
+ return Object.assign({}, noMatch$1);
2456
2741
  const posParams = {};
2457
2742
  forEach(res.posParams, (v, k) => {
2458
2743
  posParams[k] = v.path;
@@ -2569,7 +2854,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
2569
2854
  * Use of this source code is governed by an MIT-style license that can be
2570
2855
  * found in the LICENSE file at https://angular.io/license
2571
2856
  */
2572
- class NoMatch {
2857
+ class NoMatch$1 {
2573
2858
  constructor(segmentGroup) {
2574
2859
  this.segmentGroup = segmentGroup || null;
2575
2860
  }
@@ -2579,8 +2864,8 @@ class AbsoluteRedirect {
2579
2864
  this.urlTree = urlTree;
2580
2865
  }
2581
2866
  }
2582
- function noMatch$1(segmentGroup) {
2583
- return new Observable((obs) => obs.error(new NoMatch(segmentGroup)));
2867
+ function noMatch(segmentGroup) {
2868
+ return new Observable((obs) => obs.error(new NoMatch$1(segmentGroup)));
2584
2869
  }
2585
2870
  function absoluteRedirect(newTree) {
2586
2871
  return new Observable((obs) => obs.error(new AbsoluteRedirect(newTree)));
@@ -2596,7 +2881,7 @@ function canLoadFails(route) {
2596
2881
  *
2597
2882
  * Lazy modules are loaded along the way.
2598
2883
  */
2599
- function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
2884
+ function applyRedirects$1(moduleInjector, configLoader, urlSerializer, urlTree, config) {
2600
2885
  return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply();
2601
2886
  }
2602
2887
  class ApplyRedirects {
@@ -2629,7 +2914,7 @@ class ApplyRedirects {
2629
2914
  // we need to run matching, so we can fetch all lazy-loaded modules
2630
2915
  return this.match(e.urlTree);
2631
2916
  }
2632
- if (e instanceof NoMatch) {
2917
+ if (e instanceof NoMatch$1) {
2633
2918
  throw this.noMatchError(e);
2634
2919
  }
2635
2920
  throw e;
@@ -2641,7 +2926,7 @@ class ApplyRedirects {
2641
2926
  return this.createUrlTree(squashSegmentGroup(rootSegmentGroup), tree.queryParams, tree.fragment);
2642
2927
  }));
2643
2928
  return mapped$.pipe(catchError((e) => {
2644
- if (e instanceof NoMatch) {
2929
+ if (e instanceof NoMatch$1) {
2645
2930
  throw this.noMatchError(e);
2646
2931
  }
2647
2932
  throw e;
@@ -2694,7 +2979,7 @@ class ApplyRedirects {
2694
2979
  return from(routes).pipe(concatMap((r) => {
2695
2980
  const expanded$ = this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects);
2696
2981
  return expanded$.pipe(catchError((e) => {
2697
- if (e instanceof NoMatch) {
2982
+ if (e instanceof NoMatch$1) {
2698
2983
  return of(null);
2699
2984
  }
2700
2985
  throw e;
@@ -2704,14 +2989,14 @@ class ApplyRedirects {
2704
2989
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
2705
2990
  return of(new UrlSegmentGroup([], {}));
2706
2991
  }
2707
- throw new NoMatch(segmentGroup);
2992
+ throw new NoMatch$1(segmentGroup);
2708
2993
  }
2709
2994
  throw e;
2710
2995
  }));
2711
2996
  }
2712
2997
  expandSegmentAgainstRoute(ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) {
2713
2998
  if (!isImmediateMatch(route, segmentGroup, paths, outlet)) {
2714
- return noMatch$1(segmentGroup);
2999
+ return noMatch(segmentGroup);
2715
3000
  }
2716
3001
  if (route.redirectTo === undefined) {
2717
3002
  return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths, outlet);
@@ -2719,7 +3004,7 @@ class ApplyRedirects {
2719
3004
  if (allowRedirects && this.allowRedirects) {
2720
3005
  return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet);
2721
3006
  }
2722
- return noMatch$1(segmentGroup);
3007
+ return noMatch(segmentGroup);
2723
3008
  }
2724
3009
  expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) {
2725
3010
  if (route.path === '**') {
@@ -2740,7 +3025,7 @@ class ApplyRedirects {
2740
3025
  expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) {
2741
3026
  const { matched, consumedSegments, lastChild, positionalParamSegments } = match(segmentGroup, route, segments);
2742
3027
  if (!matched)
2743
- return noMatch$1(segmentGroup);
3028
+ return noMatch(segmentGroup);
2744
3029
  const newTree = this.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
2745
3030
  if (route.redirectTo.startsWith('/')) {
2746
3031
  return absoluteRedirect(newTree);
@@ -2763,7 +3048,7 @@ class ApplyRedirects {
2763
3048
  }
2764
3049
  const { matched, consumedSegments, lastChild } = match(rawSegmentGroup, route, segments);
2765
3050
  if (!matched)
2766
- return noMatch$1(rawSegmentGroup);
3051
+ return noMatch(rawSegmentGroup);
2767
3052
  const rawSlicedSegments = segments.slice(lastChild);
2768
3053
  const childConfig$ = this.getChildConfig(ngModule, route, segments);
2769
3054
  return childConfig$.pipe(mergeMap((routerConfig) => {
@@ -2941,8 +3226,8 @@ function squashSegmentGroup(segmentGroup) {
2941
3226
  * Use of this source code is governed by an MIT-style license that can be
2942
3227
  * found in the LICENSE file at https://angular.io/license
2943
3228
  */
2944
- function applyRedirects$1(moduleInjector, configLoader, urlSerializer, config) {
2945
- return switchMap(t => applyRedirects(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config)
3229
+ function applyRedirects(moduleInjector, configLoader, urlSerializer, config) {
3230
+ return switchMap(t => applyRedirects$1(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config)
2946
3231
  .pipe(map(urlAfterRedirects => (Object.assign(Object.assign({}, t), { urlAfterRedirects })))));
2947
3232
  }
2948
3233
 
@@ -3234,18 +3519,18 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3234
3519
  * Use of this source code is governed by an MIT-style license that can be
3235
3520
  * found in the LICENSE file at https://angular.io/license
3236
3521
  */
3237
- class NoMatch$1 {
3522
+ class NoMatch {
3238
3523
  }
3239
3524
  function newObservableError(e) {
3240
3525
  // TODO(atscott): This pattern is used throughout the router code and can be `throwError` instead.
3241
3526
  return new Observable((obs) => obs.error(e));
3242
3527
  }
3243
- function recognize(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
3528
+ function recognize$1(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
3244
3529
  try {
3245
3530
  const result = new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution)
3246
3531
  .recognize();
3247
3532
  if (result === null) {
3248
- return newObservableError(new NoMatch$1());
3533
+ return newObservableError(new NoMatch());
3249
3534
  }
3250
3535
  else {
3251
3536
  return of(result);
@@ -3489,8 +3774,8 @@ function getResolve(route) {
3489
3774
  * Use of this source code is governed by an MIT-style license that can be
3490
3775
  * found in the LICENSE file at https://angular.io/license
3491
3776
  */
3492
- function recognize$1(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
3493
- return mergeMap(t => recognize(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
3777
+ function recognize(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
3778
+ return mergeMap(t => recognize$1(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
3494
3779
  .pipe(map(targetSnapshot => (Object.assign(Object.assign({}, t), { targetSnapshot })))));
3495
3780
  }
3496
3781
 
@@ -3652,127 +3937,49 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
3652
3937
  */
3653
3938
  const ROUTES = new InjectionToken('ROUTES');
3654
3939
  class RouterConfigLoader {
3655
- constructor(loader, compiler, onLoadStartListener, onLoadEndListener) {
3656
- this.loader = loader;
3940
+ constructor(injector, compiler, onLoadStartListener, onLoadEndListener) {
3941
+ this.injector = injector;
3657
3942
  this.compiler = compiler;
3658
3943
  this.onLoadStartListener = onLoadStartListener;
3659
3944
  this.onLoadEndListener = onLoadEndListener;
3660
- }
3661
- load(parentInjector, route) {
3662
- if (route._loader$) {
3663
- return route._loader$;
3664
- }
3665
- if (this.onLoadStartListener) {
3666
- this.onLoadStartListener(route);
3667
- }
3668
- const moduleFactory$ = this.loadModuleFactory(route.loadChildren);
3669
- const loadRunner = moduleFactory$.pipe(map((factory) => {
3670
- if (this.onLoadEndListener) {
3671
- this.onLoadEndListener(route);
3672
- }
3673
- const module = factory.create(parentInjector);
3674
- // When loading a module that doesn't provide `RouterModule.forChild()` preloader
3675
- // will get stuck in an infinite loop. The child module's Injector will look to
3676
- // its parent `Injector` when it doesn't find any ROUTES so it will return routes
3677
- // for it's parent module instead.
3678
- return new LoadedRouterConfig(flatten(module.injector.get(ROUTES, undefined, InjectFlags.Self | InjectFlags.Optional))
3679
- .map(standardizeConfig), module);
3680
- }), catchError((err) => {
3681
- route._loader$ = undefined;
3682
- throw err;
3683
- }));
3684
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
3685
- route._loader$ = new ConnectableObservable(loadRunner, () => new Subject())
3686
- .pipe(refCount());
3687
- return route._loader$;
3688
- }
3689
- loadModuleFactory(loadChildren) {
3690
- if (typeof loadChildren === 'string') {
3691
- return from(this.loader.load(loadChildren));
3692
- }
3693
- else {
3694
- return wrapIntoObservable(loadChildren()).pipe(mergeMap((t) => {
3695
- if (t instanceof NgModuleFactory) {
3696
- return of(t);
3697
- }
3698
- else {
3699
- return from(this.compiler.compileModuleAsync(t));
3700
- }
3701
- }));
3702
- }
3703
- }
3704
- }
3705
-
3706
- /**
3707
- * @license
3708
- * Copyright Google LLC All Rights Reserved.
3709
- *
3710
- * Use of this source code is governed by an MIT-style license that can be
3711
- * found in the LICENSE file at https://angular.io/license
3712
- */
3713
- /**
3714
- * Store contextual information about a `RouterOutlet`
3715
- *
3716
- * @publicApi
3717
- */
3718
- class OutletContext {
3719
- constructor() {
3720
- this.outlet = null;
3721
- this.route = null;
3722
- this.resolver = null;
3723
- this.children = new ChildrenOutletContexts();
3724
- this.attachRef = null;
3725
- }
3726
- }
3727
- /**
3728
- * Store contextual information about the children (= nested) `RouterOutlet`
3729
- *
3730
- * @publicApi
3731
- */
3732
- class ChildrenOutletContexts {
3733
- constructor() {
3734
- // contexts for child outlets, by name.
3735
- this.contexts = new Map();
3736
- }
3737
- /** Called when a `RouterOutlet` directive is instantiated */
3738
- onChildOutletCreated(childName, outlet) {
3739
- const context = this.getOrCreateContext(childName);
3740
- context.outlet = outlet;
3741
- this.contexts.set(childName, context);
3742
- }
3743
- /**
3744
- * Called when a `RouterOutlet` directive is destroyed.
3745
- * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
3746
- * re-created later.
3747
- */
3748
- onChildOutletDestroyed(childName) {
3749
- const context = this.getContext(childName);
3750
- if (context) {
3751
- context.outlet = null;
3752
- }
3753
- }
3754
- /**
3755
- * Called when the corresponding route is deactivated during navigation.
3756
- * Because the component get destroyed, all children outlet are destroyed.
3757
- */
3758
- onOutletDeactivated() {
3759
- const contexts = this.contexts;
3760
- this.contexts = new Map();
3761
- return contexts;
3762
- }
3763
- onOutletReAttached(contexts) {
3764
- this.contexts = contexts;
3765
- }
3766
- getOrCreateContext(childName) {
3767
- let context = this.getContext(childName);
3768
- if (!context) {
3769
- context = new OutletContext();
3770
- this.contexts.set(childName, context);
3945
+ }
3946
+ load(parentInjector, route) {
3947
+ if (route._loader$) {
3948
+ return route._loader$;
3771
3949
  }
3772
- return context;
3950
+ if (this.onLoadStartListener) {
3951
+ this.onLoadStartListener(route);
3952
+ }
3953
+ const moduleFactory$ = this.loadModuleFactory(route.loadChildren);
3954
+ const loadRunner = moduleFactory$.pipe(map((factory) => {
3955
+ if (this.onLoadEndListener) {
3956
+ this.onLoadEndListener(route);
3957
+ }
3958
+ const module = factory.create(parentInjector);
3959
+ // When loading a module that doesn't provide `RouterModule.forChild()` preloader
3960
+ // will get stuck in an infinite loop. The child module's Injector will look to
3961
+ // its parent `Injector` when it doesn't find any ROUTES so it will return routes
3962
+ // for it's parent module instead.
3963
+ return new LoadedRouterConfig(flatten(module.injector.get(ROUTES, undefined, InjectFlags.Self | InjectFlags.Optional))
3964
+ .map(standardizeConfig), module);
3965
+ }), catchError((err) => {
3966
+ route._loader$ = undefined;
3967
+ throw err;
3968
+ }));
3969
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
3970
+ route._loader$ = new ConnectableObservable(loadRunner, () => new Subject())
3971
+ .pipe(refCount());
3972
+ return route._loader$;
3773
3973
  }
3774
- getContext(childName) {
3775
- return this.contexts.get(childName) || null;
3974
+ loadModuleFactory(loadChildren) {
3975
+ return wrapIntoObservable(loadChildren()).pipe(mergeMap((t) => {
3976
+ if (t instanceof NgModuleFactory) {
3977
+ return of(t);
3978
+ }
3979
+ else {
3980
+ return from(this.compiler.compileModuleAsync(t));
3981
+ }
3982
+ }));
3776
3983
  }
3777
3984
  }
3778
3985
 
@@ -3807,13 +4014,6 @@ class DefaultUrlHandlingStrategy {
3807
4014
  }
3808
4015
  }
3809
4016
 
3810
- /**
3811
- * @license
3812
- * Copyright Google LLC All Rights Reserved.
3813
- *
3814
- * Use of this source code is governed by an MIT-style license that can be
3815
- * found in the LICENSE file at https://angular.io/license
3816
- */
3817
4017
  function defaultErrorHandler(error) {
3818
4018
  throw error;
3819
4019
  }
@@ -3863,7 +4063,7 @@ class Router {
3863
4063
  * Creates the router service.
3864
4064
  */
3865
4065
  // TODO: vsavkin make internal after the final is out.
3866
- constructor(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) {
4066
+ constructor(rootComponentType, urlSerializer, rootContexts, location, injector, compiler, config) {
3867
4067
  this.rootComponentType = rootComponentType;
3868
4068
  this.urlSerializer = urlSerializer;
3869
4069
  this.rootContexts = rootContexts;
@@ -3991,7 +4191,7 @@ class Router {
3991
4191
  this.currentUrlTree = createEmptyUrlTree();
3992
4192
  this.rawUrlTree = this.currentUrlTree;
3993
4193
  this.browserUrlTree = this.currentUrlTree;
3994
- this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd);
4194
+ this.configLoader = new RouterConfigLoader(injector, compiler, onLoadStart, onLoadEnd);
3995
4195
  this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
3996
4196
  this.transitions = new BehaviorSubject({
3997
4197
  id: 0,
@@ -4077,14 +4277,14 @@ class Router {
4077
4277
  return Promise.resolve(t);
4078
4278
  }),
4079
4279
  // ApplyRedirects
4080
- applyRedirects$1(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
4280
+ applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
4081
4281
  // Update the currentNavigation
4082
4282
  // `urlAfterRedirects` is guaranteed to be set after this point
4083
4283
  tap(t => {
4084
4284
  this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4085
4285
  }),
4086
4286
  // Recognize
4087
- recognize$1(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
4287
+ recognize(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
4088
4288
  // Update URL if in `eager` update mode
4089
4289
  tap(t => {
4090
4290
  if (this.urlUpdateStrategy === 'eager') {
@@ -4217,6 +4417,7 @@ class Router {
4217
4417
  completed = true;
4218
4418
  }
4219
4419
  }), finalize(() => {
4420
+ var _a;
4220
4421
  /* When the navigation stream finishes either through error or success, we
4221
4422
  * set the `completed` or `errored` flag. However, there are some situations
4222
4423
  * where we could get here without either of those being set. For instance, a
@@ -4228,10 +4429,11 @@ class Router {
4228
4429
  const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
4229
4430
  this.cancelNavigationTransition(t, cancelationReason);
4230
4431
  }
4231
- // currentNavigation should always be reset to null here. If navigation was
4232
- // successful, lastSuccessfulTransition will have already been set. Therefore
4233
- // we can safely set currentNavigation to null here.
4234
- this.currentNavigation = null;
4432
+ // Only clear current navigation if it is still set to the one that
4433
+ // finalized.
4434
+ if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
4435
+ this.currentNavigation = null;
4436
+ }
4235
4437
  }), catchError((e) => {
4236
4438
  // TODO(atscott): The NavigationTransition `t` used here does not accurately
4237
4439
  // reflect the current state of the whole transition because some operations
@@ -4256,7 +4458,7 @@ class Router {
4256
4458
  // This is only applicable with initial navigation, so setting
4257
4459
  // `navigated` only when not redirecting resolves this scenario.
4258
4460
  this.navigated = true;
4259
- this.restoreHistory(t, true);
4461
+ this.restoreHistory(t);
4260
4462
  }
4261
4463
  const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
4262
4464
  eventsSubject.next(navCancel);
@@ -4288,7 +4490,7 @@ class Router {
4288
4490
  * the pre-error state. */
4289
4491
  }
4290
4492
  else {
4291
- this.restoreHistory(t, true);
4493
+ this.restoreHistory(t);
4292
4494
  const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e);
4293
4495
  eventsSubject.next(navError);
4294
4496
  try {
@@ -4607,26 +4809,18 @@ class Router {
4607
4809
  if (this.disposed) {
4608
4810
  return Promise.resolve(false);
4609
4811
  }
4610
- // * Duplicate navigations may also be triggered by attempts to sync AngularJS and Angular
4611
- // router states.
4612
- // * Imperative navigations can be cancelled by router guards, meaning the URL won't change. If
4613
- // the user follows that with a navigation using the back/forward button or manual URL change,
4614
- // the destination may be the same as the previous imperative attempt. We should not skip
4615
- // these navigations because it's a separate case from the one above -- it's not a duplicate
4616
- // navigation.
4812
+ // Duplicate navigations may be triggered by attempts to sync AngularJS and
4813
+ // Angular router states. We have the setTimeout in the location listener to
4814
+ // ensure the imperative nav is scheduled before the browser nav.
4617
4815
  const lastNavigation = this.transitions.value;
4618
- // We don't want to skip duplicate successful navs if they're imperative because
4619
- // onSameUrlNavigation could be 'reload' (so the duplicate is intended).
4620
4816
  const browserNavPrecededByRouterNav = isBrowserTriggeredNavigation(source) && lastNavigation &&
4621
4817
  !isBrowserTriggeredNavigation(lastNavigation.source);
4622
- const lastNavigationSucceeded = this.lastSuccessfulId === lastNavigation.id;
4623
- // If the last navigation succeeded or is in flight, we can use the rawUrl as the comparison.
4624
- // However, if it failed, we should compare to the final result (urlAfterRedirects).
4625
- const lastNavigationUrl = (lastNavigationSucceeded || this.currentNavigation) ?
4626
- lastNavigation.rawUrl :
4627
- ((_a = lastNavigation.urlAfterRedirects) !== null && _a !== void 0 ? _a : this.browserUrlTree);
4628
- const duplicateNav = lastNavigationUrl.toString() === rawUrl.toString();
4629
- if (browserNavPrecededByRouterNav && duplicateNav) {
4818
+ const navToSameUrl = lastNavigation.rawUrl.toString() === rawUrl.toString();
4819
+ const lastNavigationInProgress = lastNavigation.id === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id);
4820
+ // We consider duplicates as ones that goes to the same URL while the first
4821
+ // is still processing.
4822
+ const isDuplicateNav = navToSameUrl && lastNavigationInProgress;
4823
+ if (browserNavPrecededByRouterNav && isDuplicateNav) {
4630
4824
  return Promise.resolve(true); // return value is not used
4631
4825
  }
4632
4826
  let resolve;
@@ -4706,7 +4900,7 @@ class Router {
4706
4900
  * Performs the necessary rollback action to restore the browser URL to the
4707
4901
  * state before the transition.
4708
4902
  */
4709
- restoreHistory(t, restoringFromCaughtError = false) {
4903
+ restoreHistory(t) {
4710
4904
  var _a, _b;
4711
4905
  if (this.canceledNavigationResolution === 'computed') {
4712
4906
  const targetPagePosition = this.currentPageId - t.targetPageId;
@@ -4728,7 +4922,6 @@ class Router {
4728
4922
  // TODO(atscott): resetting the `browserUrlTree` should really be done in `resetState`.
4729
4923
  // Investigate if this can be done by running TGP.
4730
4924
  this.browserUrlTree = t.currentUrlTree;
4731
- this.resetUrlToCurrentUrlTree();
4732
4925
  }
4733
4926
  else {
4734
4927
  // The browser URL and router state was not updated before the navigation cancelled so
@@ -4736,14 +4929,7 @@ class Router {
4736
4929
  }
4737
4930
  }
4738
4931
  else if (this.canceledNavigationResolution === 'replace') {
4739
- // TODO(atscott): It seems like we should _always_ reset the state here. It would be a no-op
4740
- // for `deferred` navigations that haven't change the internal state yet because guards
4741
- // reject. For 'eager' navigations, it seems like we also really should reset the state
4742
- // because the navigation was cancelled. Investigate if this can be done by running TGP.
4743
- if (restoringFromCaughtError) {
4744
- this.resetState(t);
4745
- }
4746
- this.resetUrlToCurrentUrlTree();
4932
+ this.resetState(t);
4747
4933
  }
4748
4934
  }
4749
4935
  resetState(t) {
@@ -4755,6 +4941,7 @@ class Router {
4755
4941
  // addition, the URLHandlingStrategy may be configured to specifically preserve parts of the URL
4756
4942
  // when merging, such as the query params so they are not lost on a refresh.
4757
4943
  this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, t.rawUrl);
4944
+ this.resetUrlToCurrentUrlTree();
4758
4945
  }
4759
4946
  resetUrlToCurrentUrlTree() {
4760
4947
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
@@ -4771,19 +4958,11 @@ class Router {
4771
4958
  return { navigationId };
4772
4959
  }
4773
4960
  }
4774
- Router.decorators = [
4775
- { type: Injectable }
4776
- ];
4777
- Router.ctorParameters = () => [
4778
- { type: Type },
4779
- { type: UrlSerializer },
4780
- { type: ChildrenOutletContexts },
4781
- { type: Location },
4782
- { type: Injector },
4783
- { type: NgModuleFactoryLoader },
4784
- { type: Compiler },
4785
- { type: undefined }
4786
- ];
4961
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
4962
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: Router });
4963
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: Router, decorators: [{
4964
+ type: Injectable
4965
+ }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
4787
4966
  function validateCommands(commands) {
4788
4967
  for (let i = 0; i < commands.length; i++) {
4789
4968
  const cmd = commands[i];
@@ -4796,13 +4975,6 @@ function isBrowserTriggeredNavigation(source) {
4796
4975
  return source !== 'imperative';
4797
4976
  }
4798
4977
 
4799
- /**
4800
- * @license
4801
- * Copyright Google LLC All Rights Reserved.
4802
- *
4803
- * Use of this source code is governed by an MIT-style license that can be
4804
- * found in the LICENSE file at https://angular.io/license
4805
- */
4806
4978
  /**
4807
4979
  * @description
4808
4980
  *
@@ -4980,28 +5152,38 @@ class RouterLink {
4980
5152
  });
4981
5153
  }
4982
5154
  }
4983
- RouterLink.decorators = [
4984
- { type: Directive, args: [{ selector: ':not(a):not(area)[routerLink]' },] }
4985
- ];
4986
- RouterLink.ctorParameters = () => [
4987
- { type: Router },
4988
- { type: ActivatedRoute },
4989
- { type: undefined, decorators: [{ type: Attribute, args: ['tabindex',] }] },
4990
- { type: Renderer2 },
4991
- { type: ElementRef }
4992
- ];
4993
- RouterLink.propDecorators = {
4994
- queryParams: [{ type: Input }],
4995
- fragment: [{ type: Input }],
4996
- queryParamsHandling: [{ type: Input }],
4997
- preserveFragment: [{ type: Input }],
4998
- skipLocationChange: [{ type: Input }],
4999
- replaceUrl: [{ type: Input }],
5000
- state: [{ type: Input }],
5001
- relativeTo: [{ type: Input }],
5002
- routerLink: [{ type: Input }],
5003
- onClick: [{ type: HostListener, args: ['click',] }]
5004
- };
5155
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5156
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.2", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLink, decorators: [{
5158
+ type: Directive,
5159
+ args: [{ selector: ':not(a):not(area)[routerLink]' }]
5160
+ }], ctorParameters: function () {
5161
+ return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
5162
+ type: Attribute,
5163
+ args: ['tabindex']
5164
+ }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }];
5165
+ }, propDecorators: { queryParams: [{
5166
+ type: Input
5167
+ }], fragment: [{
5168
+ type: Input
5169
+ }], queryParamsHandling: [{
5170
+ type: Input
5171
+ }], preserveFragment: [{
5172
+ type: Input
5173
+ }], skipLocationChange: [{
5174
+ type: Input
5175
+ }], replaceUrl: [{
5176
+ type: Input
5177
+ }], state: [{
5178
+ type: Input
5179
+ }], relativeTo: [{
5180
+ type: Input
5181
+ }], routerLink: [{
5182
+ type: Input
5183
+ }], onClick: [{
5184
+ type: HostListener,
5185
+ args: ['click']
5186
+ }] } });
5005
5187
  /**
5006
5188
  * @description
5007
5189
  *
@@ -5091,29 +5273,42 @@ class RouterLinkWithHref {
5091
5273
  });
5092
5274
  }
5093
5275
  }
5094
- RouterLinkWithHref.decorators = [
5095
- { type: Directive, args: [{ selector: 'a[routerLink],area[routerLink]' },] }
5096
- ];
5097
- RouterLinkWithHref.ctorParameters = () => [
5098
- { type: Router },
5099
- { type: ActivatedRoute },
5100
- { type: LocationStrategy }
5101
- ];
5102
- RouterLinkWithHref.propDecorators = {
5103
- target: [{ type: HostBinding, args: ['attr.target',] }, { type: Input }],
5104
- queryParams: [{ type: Input }],
5105
- fragment: [{ type: Input }],
5106
- queryParamsHandling: [{ type: Input }],
5107
- preserveFragment: [{ type: Input }],
5108
- skipLocationChange: [{ type: Input }],
5109
- replaceUrl: [{ type: Input }],
5110
- state: [{ type: Input }],
5111
- relativeTo: [{ type: Input }],
5112
- href: [{ type: HostBinding, args: ['attr.href',] }],
5113
- routerLink: [{ type: Input }],
5114
- onClick: [{ type: HostListener, args: ['click',
5115
- ['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey'],] }]
5116
- };
5276
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5277
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.2", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5279
+ type: Directive,
5280
+ args: [{ selector: 'a[routerLink],area[routerLink]' }]
5281
+ }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
5282
+ type: HostBinding,
5283
+ args: ['attr.target']
5284
+ }, {
5285
+ type: Input
5286
+ }], queryParams: [{
5287
+ type: Input
5288
+ }], fragment: [{
5289
+ type: Input
5290
+ }], queryParamsHandling: [{
5291
+ type: Input
5292
+ }], preserveFragment: [{
5293
+ type: Input
5294
+ }], skipLocationChange: [{
5295
+ type: Input
5296
+ }], replaceUrl: [{
5297
+ type: Input
5298
+ }], state: [{
5299
+ type: Input
5300
+ }], relativeTo: [{
5301
+ type: Input
5302
+ }], href: [{
5303
+ type: HostBinding,
5304
+ args: ['attr.href']
5305
+ }], routerLink: [{
5306
+ type: Input
5307
+ }], onClick: [{
5308
+ type: HostListener,
5309
+ args: ['click',
5310
+ ['$event.button', '$event.ctrlKey', '$event.shiftKey', '$event.altKey', '$event.metaKey']]
5311
+ }] } });
5117
5312
  function attrBoolValue(s) {
5118
5313
  return s === '' || !!s;
5119
5314
  }
@@ -5294,27 +5489,33 @@ class RouterLinkActive {
5294
5489
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5295
5490
  }
5296
5491
  }
5297
- RouterLinkActive.decorators = [
5298
- { type: Directive, args: [{
5299
- selector: '[routerLinkActive]',
5300
- exportAs: 'routerLinkActive',
5301
- },] }
5302
- ];
5303
- RouterLinkActive.ctorParameters = () => [
5304
- { type: Router },
5305
- { type: ElementRef },
5306
- { type: Renderer2 },
5307
- { type: ChangeDetectorRef },
5308
- { type: RouterLink, decorators: [{ type: Optional }] },
5309
- { type: RouterLinkWithHref, decorators: [{ type: Optional }] }
5310
- ];
5311
- RouterLinkActive.propDecorators = {
5312
- links: [{ type: ContentChildren, args: [RouterLink, { descendants: true },] }],
5313
- linksWithHrefs: [{ type: ContentChildren, args: [RouterLinkWithHref, { descendants: true },] }],
5314
- routerLinkActiveOptions: [{ type: Input }],
5315
- isActiveChange: [{ type: Output }],
5316
- routerLinkActive: [{ type: Input }]
5317
- };
5492
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5493
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0-rc.2", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterLinkActive, decorators: [{
5495
+ type: Directive,
5496
+ args: [{
5497
+ selector: '[routerLinkActive]',
5498
+ exportAs: 'routerLinkActive',
5499
+ }]
5500
+ }], ctorParameters: function () {
5501
+ return [{ type: Router }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: RouterLink, decorators: [{
5502
+ type: Optional
5503
+ }] }, { type: RouterLinkWithHref, decorators: [{
5504
+ type: Optional
5505
+ }] }];
5506
+ }, propDecorators: { links: [{
5507
+ type: ContentChildren,
5508
+ args: [RouterLink, { descendants: true }]
5509
+ }], linksWithHrefs: [{
5510
+ type: ContentChildren,
5511
+ args: [RouterLinkWithHref, { descendants: true }]
5512
+ }], routerLinkActiveOptions: [{
5513
+ type: Input
5514
+ }], isActiveChange: [{
5515
+ type: Output
5516
+ }], routerLinkActive: [{
5517
+ type: Input
5518
+ }] } });
5318
5519
  /**
5319
5520
  * Use instead of `'paths' in options` to be compatible with property renaming
5320
5521
  */
@@ -5322,195 +5523,6 @@ function isActiveMatchOptions(options) {
5322
5523
  return !!options.paths;
5323
5524
  }
5324
5525
 
5325
- /**
5326
- * @license
5327
- * Copyright Google LLC All Rights Reserved.
5328
- *
5329
- * Use of this source code is governed by an MIT-style license that can be
5330
- * found in the LICENSE file at https://angular.io/license
5331
- */
5332
- /**
5333
- * @description
5334
- *
5335
- * Acts as a placeholder that Angular dynamically fills based on the current router state.
5336
- *
5337
- * Each outlet can have a unique name, determined by the optional `name` attribute.
5338
- * The name cannot be set or changed dynamically. If not set, default value is "primary".
5339
- *
5340
- * ```
5341
- * <router-outlet></router-outlet>
5342
- * <router-outlet name='left'></router-outlet>
5343
- * <router-outlet name='right'></router-outlet>
5344
- * ```
5345
- *
5346
- * Named outlets can be the targets of secondary routes.
5347
- * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:
5348
- *
5349
- * `{path: <base-path>, component: <component>, outlet: <target_outlet_name>}`
5350
- *
5351
- * Using named outlets and secondary routes, you can target multiple outlets in
5352
- * the same `RouterLink` directive.
5353
- *
5354
- * The router keeps track of separate branches in a navigation tree for each named outlet and
5355
- * generates a representation of that tree in the URL.
5356
- * The URL for a secondary route uses the following syntax to specify both the primary and secondary
5357
- * routes at the same time:
5358
- *
5359
- * `http://base-path/primary-route-path(outlet-name:route-path)`
5360
- *
5361
- * A router outlet emits an activate event when a new component is instantiated,
5362
- * and a deactivate event when a component is destroyed.
5363
- *
5364
- * ```
5365
- * <router-outlet
5366
- * (activate)='onActivate($event)'
5367
- * (deactivate)='onDeactivate($event)'></router-outlet>
5368
- * ```
5369
- *
5370
- * @see [Routing tutorial](guide/router-tutorial-toh#named-outlets "Example of a named
5371
- * outlet and secondary route configuration").
5372
- * @see `RouterLink`
5373
- * @see `Route`
5374
- * @ngModule RouterModule
5375
- *
5376
- * @publicApi
5377
- */
5378
- class RouterOutlet {
5379
- constructor(parentContexts, location, resolver, name, changeDetector) {
5380
- this.parentContexts = parentContexts;
5381
- this.location = location;
5382
- this.resolver = resolver;
5383
- this.changeDetector = changeDetector;
5384
- this.activated = null;
5385
- this._activatedRoute = null;
5386
- this.activateEvents = new EventEmitter();
5387
- this.deactivateEvents = new EventEmitter();
5388
- this.name = name || PRIMARY_OUTLET;
5389
- parentContexts.onChildOutletCreated(this.name, this);
5390
- }
5391
- /** @nodoc */
5392
- ngOnDestroy() {
5393
- this.parentContexts.onChildOutletDestroyed(this.name);
5394
- }
5395
- /** @nodoc */
5396
- ngOnInit() {
5397
- if (!this.activated) {
5398
- // If the outlet was not instantiated at the time the route got activated we need to populate
5399
- // the outlet when it is initialized (ie inside a NgIf)
5400
- const context = this.parentContexts.getContext(this.name);
5401
- if (context && context.route) {
5402
- if (context.attachRef) {
5403
- // `attachRef` is populated when there is an existing component to mount
5404
- this.attach(context.attachRef, context.route);
5405
- }
5406
- else {
5407
- // otherwise the component defined in the configuration is created
5408
- this.activateWith(context.route, context.resolver || null);
5409
- }
5410
- }
5411
- }
5412
- }
5413
- get isActivated() {
5414
- return !!this.activated;
5415
- }
5416
- /**
5417
- * @returns The currently activated component instance.
5418
- * @throws An error if the outlet is not activated.
5419
- */
5420
- get component() {
5421
- if (!this.activated)
5422
- throw new Error('Outlet is not activated');
5423
- return this.activated.instance;
5424
- }
5425
- get activatedRoute() {
5426
- if (!this.activated)
5427
- throw new Error('Outlet is not activated');
5428
- return this._activatedRoute;
5429
- }
5430
- get activatedRouteData() {
5431
- if (this._activatedRoute) {
5432
- return this._activatedRoute.snapshot.data;
5433
- }
5434
- return {};
5435
- }
5436
- /**
5437
- * Called when the `RouteReuseStrategy` instructs to detach the subtree
5438
- */
5439
- detach() {
5440
- if (!this.activated)
5441
- throw new Error('Outlet is not activated');
5442
- this.location.detach();
5443
- const cmp = this.activated;
5444
- this.activated = null;
5445
- this._activatedRoute = null;
5446
- return cmp;
5447
- }
5448
- /**
5449
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
5450
- */
5451
- attach(ref, activatedRoute) {
5452
- this.activated = ref;
5453
- this._activatedRoute = activatedRoute;
5454
- this.location.insert(ref.hostView);
5455
- }
5456
- deactivate() {
5457
- if (this.activated) {
5458
- const c = this.component;
5459
- this.activated.destroy();
5460
- this.activated = null;
5461
- this._activatedRoute = null;
5462
- this.deactivateEvents.emit(c);
5463
- }
5464
- }
5465
- activateWith(activatedRoute, resolver) {
5466
- if (this.isActivated) {
5467
- throw new Error('Cannot activate an already activated outlet');
5468
- }
5469
- this._activatedRoute = activatedRoute;
5470
- const snapshot = activatedRoute._futureSnapshot;
5471
- const component = snapshot.routeConfig.component;
5472
- resolver = resolver || this.resolver;
5473
- const factory = resolver.resolveComponentFactory(component);
5474
- const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
5475
- const injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
5476
- this.activated = this.location.createComponent(factory, this.location.length, injector);
5477
- // Calling `markForCheck` to make sure we will run the change detection when the
5478
- // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
5479
- this.changeDetector.markForCheck();
5480
- this.activateEvents.emit(this.activated.instance);
5481
- }
5482
- }
5483
- RouterOutlet.decorators = [
5484
- { type: Directive, args: [{ selector: 'router-outlet', exportAs: 'outlet' },] }
5485
- ];
5486
- RouterOutlet.ctorParameters = () => [
5487
- { type: ChildrenOutletContexts },
5488
- { type: ViewContainerRef },
5489
- { type: ComponentFactoryResolver },
5490
- { type: String, decorators: [{ type: Attribute, args: ['name',] }] },
5491
- { type: ChangeDetectorRef }
5492
- ];
5493
- RouterOutlet.propDecorators = {
5494
- activateEvents: [{ type: Output, args: ['activate',] }],
5495
- deactivateEvents: [{ type: Output, args: ['deactivate',] }]
5496
- };
5497
- class OutletInjector {
5498
- constructor(route, childContexts, parent) {
5499
- this.route = route;
5500
- this.childContexts = childContexts;
5501
- this.parent = parent;
5502
- }
5503
- get(token, notFoundValue) {
5504
- if (token === ActivatedRoute) {
5505
- return this.route;
5506
- }
5507
- if (token === ChildrenOutletContexts) {
5508
- return this.childContexts;
5509
- }
5510
- return this.parent.get(token, notFoundValue);
5511
- }
5512
- }
5513
-
5514
5526
  /**
5515
5527
  * @license
5516
5528
  * Copyright Google LLC All Rights Reserved.
@@ -5570,13 +5582,13 @@ class NoPreloading {
5570
5582
  * @publicApi
5571
5583
  */
5572
5584
  class RouterPreloader {
5573
- constructor(router, moduleLoader, compiler, injector, preloadingStrategy) {
5585
+ constructor(router, compiler, injector, preloadingStrategy) {
5574
5586
  this.router = router;
5575
5587
  this.injector = injector;
5576
5588
  this.preloadingStrategy = preloadingStrategy;
5577
5589
  const onStartLoad = (r) => router.triggerEvent(new RouteConfigLoadStart(r));
5578
5590
  const onEndLoad = (r) => router.triggerEvent(new RouteConfigLoadEnd(r));
5579
- this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad);
5591
+ this.loader = new RouterConfigLoader(injector, compiler, onStartLoad, onEndLoad);
5580
5592
  }
5581
5593
  setUpPreloading() {
5582
5594
  this.subscription =
@@ -5624,24 +5636,12 @@ class RouterPreloader {
5624
5636
  });
5625
5637
  }
5626
5638
  }
5627
- RouterPreloader.decorators = [
5628
- { type: Injectable }
5629
- ];
5630
- RouterPreloader.ctorParameters = () => [
5631
- { type: Router },
5632
- { type: NgModuleFactoryLoader },
5633
- { type: Compiler },
5634
- { type: Injector },
5635
- { type: PreloadingStrategy }
5636
- ];
5639
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.Injector }, { token: PreloadingStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
5640
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterPreloader });
5641
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterPreloader, decorators: [{
5642
+ type: Injectable
5643
+ }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.Injector }, { type: PreloadingStrategy }]; } });
5637
5644
 
5638
- /**
5639
- * @license
5640
- * Copyright Google LLC All Rights Reserved.
5641
- *
5642
- * Use of this source code is governed by an MIT-style license that can be
5643
- * found in the LICENSE file at https://angular.io/license
5644
- */
5645
5645
  class RouterScroller {
5646
5646
  constructor(router,
5647
5647
  /** @docsNotRequired */ viewportScroller, options = {}) {
@@ -5717,14 +5717,11 @@ class RouterScroller {
5717
5717
  }
5718
5718
  }
5719
5719
  }
5720
- RouterScroller.decorators = [
5721
- { type: Injectable }
5722
- ];
5723
- RouterScroller.ctorParameters = () => [
5724
- { type: Router },
5725
- { type: ViewportScroller },
5726
- { type: undefined }
5727
- ];
5720
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5721
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterScroller });
5722
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterScroller, decorators: [{
5723
+ type: Injectable
5724
+ }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
5728
5725
 
5729
5726
  /**
5730
5727
  * @license
@@ -5747,7 +5744,6 @@ const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
5747
5744
  * @docsNotRequired
5748
5745
  */
5749
5746
  const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
5750
- const ɵ0 = { enableTracing: false };
5751
5747
  const ROUTER_PROVIDERS = [
5752
5748
  Location,
5753
5749
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
@@ -5755,18 +5751,17 @@ const ROUTER_PROVIDERS = [
5755
5751
  provide: Router,
5756
5752
  useFactory: setupRouter,
5757
5753
  deps: [
5758
- UrlSerializer, ChildrenOutletContexts, Location, Injector, NgModuleFactoryLoader, Compiler,
5759
- ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
5754
+ UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
5755
+ ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
5760
5756
  [RouteReuseStrategy, new Optional()]
5761
5757
  ]
5762
5758
  },
5763
5759
  ChildrenOutletContexts,
5764
5760
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
5765
- { provide: NgModuleFactoryLoader, useClass: SystemJsNgModuleLoader },
5766
5761
  RouterPreloader,
5767
5762
  NoPreloading,
5768
5763
  PreloadAllModules,
5769
- { provide: ROUTER_CONFIGURATION, useValue: ɵ0 },
5764
+ { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
5770
5765
  ];
5771
5766
  function routerNgProbeToken() {
5772
5767
  return new NgProbeToken('Router', Router);
@@ -5865,17 +5860,26 @@ class RouterModule {
5865
5860
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
5866
5861
  }
5867
5862
  }
5868
- RouterModule.decorators = [
5869
- { type: NgModule, args: [{
5870
- declarations: ROUTER_DIRECTIVES,
5871
- exports: ROUTER_DIRECTIVES,
5872
- entryComponents: [ɵEmptyOutletComponent]
5873
- },] }
5874
- ];
5875
- RouterModule.ctorParameters = () => [
5876
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [ROUTER_FORROOT_GUARD,] }] },
5877
- { type: Router, decorators: [{ type: Optional }] }
5878
- ];
5863
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
5864
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
5865
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterModule });
5866
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterModule, decorators: [{
5867
+ type: NgModule,
5868
+ args: [{
5869
+ declarations: ROUTER_DIRECTIVES,
5870
+ exports: ROUTER_DIRECTIVES,
5871
+ entryComponents: [ɵEmptyOutletComponent]
5872
+ }]
5873
+ }], ctorParameters: function () {
5874
+ return [{ type: undefined, decorators: [{
5875
+ type: Optional
5876
+ }, {
5877
+ type: Inject,
5878
+ args: [ROUTER_FORROOT_GUARD]
5879
+ }] }, { type: Router, decorators: [{
5880
+ type: Optional
5881
+ }] }];
5882
+ } });
5879
5883
  function createRouterScroller(router, viewportScroller, config) {
5880
5884
  if (config.scrollOffset) {
5881
5885
  viewportScroller.setOffset(config.scrollOffset);
@@ -5914,8 +5918,8 @@ function provideRoutes(routes) {
5914
5918
  { provide: ROUTES, multi: true, useValue: routes },
5915
5919
  ];
5916
5920
  }
5917
- function setupRouter(urlSerializer, contexts, location, injector, loader, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
5918
- const router = new Router(null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));
5921
+ function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
5922
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
5919
5923
  if (urlHandlingStrategy) {
5920
5924
  router.urlHandlingStrategy = urlHandlingStrategy;
5921
5925
  }
@@ -5955,6 +5959,9 @@ function assignExtraOptionsToRouter(opts, router) {
5955
5959
  if (opts.urlUpdateStrategy) {
5956
5960
  router.urlUpdateStrategy = opts.urlUpdateStrategy;
5957
5961
  }
5962
+ if (opts.canceledNavigationResolution) {
5963
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
5964
+ }
5958
5965
  }
5959
5966
  function rootRoute(router) {
5960
5967
  return router.routerState.root;
@@ -6038,12 +6045,11 @@ class RouterInitializer {
6038
6045
  this.destroyed = true;
6039
6046
  }
6040
6047
  }
6041
- RouterInitializer.decorators = [
6042
- { type: Injectable }
6043
- ];
6044
- RouterInitializer.ctorParameters = () => [
6045
- { type: Injector }
6046
- ];
6048
+ RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6049
+ RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterInitializer });
6050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0-rc.2", ngImport: i0, type: RouterInitializer, decorators: [{
6051
+ type: Injectable
6052
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
6047
6053
  function getAppInitializer(r) {
6048
6054
  return r.appInitializer.bind(r);
6049
6055
  }
@@ -6081,7 +6087,7 @@ function provideRouterInitializer() {
6081
6087
  /**
6082
6088
  * @publicApi
6083
6089
  */
6084
- const VERSION = new Version('13.0.0-next.8');
6090
+ const VERSION = new Version('13.0.0-rc.2');
6085
6091
 
6086
6092
  /**
6087
6093
  * @license
@@ -6120,5 +6126,5 @@ const VERSION = new Version('13.0.0-next.8');
6120
6126
  * Generated bundle index. Do not edit.
6121
6127
  */
6122
6128
 
6123
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, ROUTER_FORROOT_GUARD as ɵangular_packages_router_router_a, routerNgProbeToken as ɵangular_packages_router_router_b, createRouterScroller as ɵangular_packages_router_router_c, provideLocationStrategy as ɵangular_packages_router_router_d, provideForRootGuard as ɵangular_packages_router_router_e, setupRouter as ɵangular_packages_router_router_f, rootRoute as ɵangular_packages_router_router_g, RouterInitializer as ɵangular_packages_router_router_h, getAppInitializer as ɵangular_packages_router_router_i, getBootstrapListener as ɵangular_packages_router_router_j, provideRouterInitializer as ɵangular_packages_router_router_k, ɵEmptyOutletComponent as ɵangular_packages_router_router_l, Tree as ɵangular_packages_router_router_m, TreeNode as ɵangular_packages_router_router_n, RouterScroller as ɵangular_packages_router_router_o, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
6124
- //# sourceMappingURL=router.js.map
6129
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
6130
+ //# sourceMappingURL=router.mjs.map