@angular/router 18.1.0-next.2 → 18.1.0-next.3

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -59,16 +59,16 @@ class RouterTestingModule {
59
59
  ],
60
60
  };
61
61
  }
62
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
63
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.0-next.2", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
64
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RouterTestingModule, providers: [
62
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
63
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.0-next.3", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] }); }
64
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RouterTestingModule, providers: [
65
65
  ɵROUTER_PROVIDERS,
66
66
  provideLocationMocks(),
67
67
  withPreloading(NoPreloading).ɵproviders,
68
68
  { provide: ROUTES, multi: true, useValue: [] },
69
69
  ], imports: [RouterModule] }); }
70
70
  }
71
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RouterTestingModule, decorators: [{
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RouterTestingModule, decorators: [{
72
72
  type: NgModule,
73
73
  args: [{
74
74
  exports: [RouterModule],
@@ -97,18 +97,18 @@ class RootFixtureService {
97
97
  this.fixture.detectChanges();
98
98
  return this.fixture;
99
99
  }
100
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
101
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
101
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RootFixtureService, providedIn: 'root' }); }
102
102
  }
103
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RootFixtureService, decorators: [{
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RootFixtureService, decorators: [{
104
104
  type: Injectable,
105
105
  args: [{ providedIn: 'root' }]
106
106
  }] });
107
107
  class RootCmp {
108
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.0-next.2", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
108
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
109
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.0-next.3", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
110
110
  }
111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.2", ngImport: i0, type: RootCmp, decorators: [{
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0-next.3", ngImport: i0, type: RootCmp, decorators: [{
112
112
  type: Component,
113
113
  args: [{
114
114
  standalone: true,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -299,10 +299,6 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
299
299
  * ```
300
300
  *
301
301
  * @publicApi
302
- * @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
303
- * injectable class can be used as a functional guard using the [`inject`](api/core/inject)
304
- * function: `canActivate: [() => inject(myGuard).canActivate()]`.
305
- * @see {@link CanActivateFn}
306
302
  */
307
303
  export declare interface CanActivate {
308
304
  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
@@ -365,10 +361,6 @@ export declare interface CanActivate {
365
361
  * ```
366
362
  *
367
363
  * @publicApi
368
- * @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
369
- * injectable class can be used as a functional guard using the [`inject`](api/core/inject)
370
- * function: `canActivateChild: [() => inject(myGuard).canActivateChild()]`.
371
- * @see {@link CanActivateChildFn}
372
364
  */
373
365
  export declare interface CanActivateChild {
374
366
  canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>;
@@ -500,10 +492,6 @@ export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: Route
500
492
  * ```
501
493
  *
502
494
  * @publicApi
503
- * @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
504
- * injectable class can be used as a functional guard using the [`inject`](api/core/inject)
505
- * function: `canDeactivate: [() => inject(myGuard).canDeactivate()]`.
506
- * @see {@link CanDeactivateFn}
507
495
  */
508
496
  export declare interface CanDeactivate<T> {
509
497
  canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): MaybeAsync<GuardResult>;
@@ -578,7 +566,7 @@ export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedR
578
566
  * ```
579
567
  *
580
568
  * @publicApi
581
- * @deprecated Use {@link CanMatchFn} instead
569
+ * @deprecated Use {@link CanMatch} instead
582
570
  */
583
571
  export declare interface CanLoad {
584
572
  canLoad(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
@@ -590,7 +578,7 @@ export declare interface CanLoad {
590
578
  * @publicApi
591
579
  * @see {@link CanLoad}
592
580
  * @see {@link Route}
593
- * @see {@link CanMatchFn}
581
+ * @see {@link CanMatch}
594
582
  * @deprecated Use `Route.canMatch` and `CanMatchFn` instead
595
583
  */
596
584
  export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>;
@@ -655,10 +643,6 @@ export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => MaybeA
655
643
  * could not be used for a URL match but the catch-all `**` `Route` did instead.
656
644
  *
657
645
  * @publicApi
658
- * @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
659
- * injectable class can be used as a functional guard using the [`inject`](api/core/inject)
660
- * function: `canMatch: [() => inject(myGuard).canMatch()]`.
661
- * @see {@link CanMatchFn}
662
646
  */
663
647
  export declare interface CanMatch {
664
648
  canMatch(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>;
@@ -1398,9 +1382,7 @@ declare interface LoadedRouterConfig {
1398
1382
  * @publicApi
1399
1383
  * @see {@link Route}
1400
1384
  */
1401
- export declare function mapToCanActivate(providers: Array<Type<{
1402
- canActivate: CanActivateFn;
1403
- }>>): CanActivateFn[];
1385
+ export declare function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[];
1404
1386
 
1405
1387
  /**
1406
1388
  * Maps an array of injectable classes with canActivateChild functions to an array of equivalent
@@ -1411,9 +1393,7 @@ export declare function mapToCanActivate(providers: Array<Type<{
1411
1393
  * @publicApi
1412
1394
  * @see {@link Route}
1413
1395
  */
1414
- export declare function mapToCanActivateChild(providers: Array<Type<{
1415
- canActivateChild: CanActivateChildFn;
1416
- }>>): CanActivateChildFn[];
1396
+ export declare function mapToCanActivateChild(providers: Array<Type<CanActivateChild>>): CanActivateChildFn[];
1417
1397
 
1418
1398
  /**
1419
1399
  * Maps an array of injectable classes with canDeactivate functions to an array of equivalent
@@ -1424,9 +1404,7 @@ export declare function mapToCanActivateChild(providers: Array<Type<{
1424
1404
  * @publicApi
1425
1405
  * @see {@link Route}
1426
1406
  */
1427
- export declare function mapToCanDeactivate<T = unknown>(providers: Array<Type<{
1428
- canDeactivate: CanDeactivateFn<T>;
1429
- }>>): CanDeactivateFn<T>[];
1407
+ export declare function mapToCanDeactivate<T = unknown>(providers: Array<Type<CanDeactivate<T>>>): CanDeactivateFn<T>[];
1430
1408
 
1431
1409
  /**
1432
1410
  * Maps an array of injectable classes with canMatch functions to an array of equivalent
@@ -1437,9 +1415,7 @@ export declare function mapToCanDeactivate<T = unknown>(providers: Array<Type<{
1437
1415
  * @publicApi
1438
1416
  * @see {@link Route}
1439
1417
  */
1440
- export declare function mapToCanMatch(providers: Array<Type<{
1441
- canMatch: CanMatchFn;
1442
- }>>): CanMatchFn[];
1418
+ export declare function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[];
1443
1419
 
1444
1420
  /**
1445
1421
  * Maps an injectable class with a resolve function to an equivalent `ResolveFn`
@@ -1450,9 +1426,7 @@ export declare function mapToCanMatch(providers: Array<Type<{
1450
1426
  * @publicApi
1451
1427
  * @see {@link Route}
1452
1428
  */
1453
- export declare function mapToResolve<T>(provider: Type<{
1454
- resolve: ResolveFn<T>;
1455
- }>): ResolveFn<T>;
1429
+ export declare function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T>;
1456
1430
 
1457
1431
  /**
1458
1432
  * Type used to represent a value which may be synchronous or async.
@@ -1611,6 +1585,40 @@ export declare interface NavigationBehaviorOptions {
1611
1585
  * when the transition has finished animating.
1612
1586
  */
1613
1587
  readonly info?: unknown;
1588
+ /**
1589
+ * When set, the Router will update the browser's address bar to match the given `UrlTree` instead
1590
+ * of the one used for route matching.
1591
+ *
1592
+ *
1593
+ * @usageNotes
1594
+ *
1595
+ * This feature is useful for redirects, such as redirecting to an error page, without changing
1596
+ * the value that will be displayed in the browser's address bar.
1597
+ *
1598
+ * ```
1599
+ * const canActivate: CanActivateFn = (route: ActivatedRouteSnapshot) => {
1600
+ * const userService = inject(UserService);
1601
+ * const router = inject(Router);
1602
+ * if (!userService.isLoggedIn()) {
1603
+ * const targetOfCurrentNavigation = router.getCurrentNavigation()?.finalUrl;
1604
+ * const redirect = router.parseUrl('/404');
1605
+ * return new RedirectCommand(redirect, {browserUrl: targetOfCurrentNavigation});
1606
+ * }
1607
+ * return true;
1608
+ * };
1609
+ * ```
1610
+ *
1611
+ * This value is used directly, without considering any `UrlHandingStrategy`. In this way,
1612
+ * `browserUrl` can also be used to use a different value for the browser URL than what would have
1613
+ * been produced by from the navigation due to `UrlHandlingStrategy.merge`.
1614
+ *
1615
+ * This value only affects the path presented in the browser's address bar. It does not apply to
1616
+ * the internal `Router` state. Information such as `params` and `data` will match the internal
1617
+ * state used to match routes which will be different from the browser URL when using this feature
1618
+ * The same is true when using other APIs that cause the browser URL the differ from the Router
1619
+ * state, such as `skipLocationChange`.
1620
+ */
1621
+ readonly browserUrl?: UrlTree | string;
1614
1622
  }
1615
1623
 
1616
1624
  /**
@@ -2261,10 +2269,6 @@ export declare type RedirectFunction = (redirectData: Pick<ActivatedRouteSnapsho
2261
2269
  * The order of execution is: BaseGuard, ChildGuard, BaseDataResolver, ChildDataResolver.
2262
2270
  *
2263
2271
  * @publicApi
2264
- * @deprecated Class-based `Route` resolvers are deprecated in favor of functional resolvers. An
2265
- * injectable class can be used as a functional guard using the [`inject`](api/core/inject)
2266
- function: `resolve:
2267
- * {'user': () => inject(UserResolver).resolve()}`.
2268
2272
  * @see {@link ResolveFn}
2269
2273
  */
2270
2274
  export declare interface Resolve<T> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/router",
3
- "version": "18.1.0-next.2",
3
+ "version": "18.1.0-next.3",
4
4
  "description": "Angular - the routing library",
5
5
  "keywords": [
6
6
  "angular",
@@ -24,9 +24,9 @@
24
24
  "tslib": "^2.3.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@angular/core": "18.1.0-next.2",
28
- "@angular/common": "18.1.0-next.2",
29
- "@angular/platform-browser": "18.1.0-next.2",
27
+ "@angular/core": "18.1.0-next.3",
28
+ "@angular/common": "18.1.0-next.3",
29
+ "@angular/platform-browser": "18.1.0-next.3",
30
30
  "rxjs": "^6.5.3 || ^7.4.0"
31
31
  },
32
32
  "ng-update": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.0-next.2
2
+ * @license Angular v18.1.0-next.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */