@angular/router 15.2.0-next.3 → 15.2.0-rc.0
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.
- package/esm2020/src/components/empty_outlet.mjs +3 -3
- package/esm2020/src/create_url_tree_strategy.mjs +22 -11
- package/esm2020/src/directives/router_link.mjs +3 -3
- package/esm2020/src/directives/router_link_active.mjs +3 -3
- package/esm2020/src/directives/router_outlet.mjs +3 -3
- package/esm2020/src/models.mjs +1 -1
- package/esm2020/src/navigation_transition.mjs +3 -3
- package/esm2020/src/page_title_strategy.mjs +6 -6
- package/esm2020/src/provide_router.mjs +2 -2
- package/esm2020/src/route_reuse_strategy.mjs +6 -6
- package/esm2020/src/router.mjs +13 -9
- package/esm2020/src/router_config_loader.mjs +3 -3
- package/esm2020/src/router_module.mjs +4 -4
- package/esm2020/src/router_outlet_context.mjs +3 -3
- package/esm2020/src/router_preloader.mjs +9 -9
- package/esm2020/src/router_scroller.mjs +3 -3
- package/esm2020/src/url_handling_strategy.mjs +6 -6
- package/esm2020/src/url_tree.mjs +4 -4
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/router_testing_harness.mjs +6 -6
- package/esm2020/testing/src/router_testing_module.mjs +4 -4
- package/fesm2015/router.mjs +94 -79
- package/fesm2015/router.mjs.map +1 -1
- package/fesm2015/testing.mjs +11 -11
- package/fesm2015/upgrade.mjs +1 -1
- package/fesm2020/router.mjs +94 -79
- package/fesm2020/router.mjs.map +1 -1
- package/fesm2020/testing.mjs +11 -11
- package/fesm2020/upgrade.mjs +1 -1
- package/index.d.ts +96 -135
- package/package.json +4 -4
- package/testing/index.d.ts +1 -1
- package/upgrade/index.d.ts +1 -1
package/fesm2020/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.2.0-
|
|
2
|
+
* @license Angular v15.2.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -110,15 +110,15 @@ class RouterTestingModule {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-
|
|
114
|
-
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.0-
|
|
115
|
-
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.0-
|
|
113
|
+
RouterTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
114
|
+
RouterTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
|
|
115
|
+
RouterTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RouterTestingModule, providers: [
|
|
116
116
|
ɵROUTER_PROVIDERS,
|
|
117
117
|
provideLocationMocks(),
|
|
118
118
|
ɵwithPreloading(NoPreloading).ɵproviders,
|
|
119
119
|
{ provide: ROUTES, multi: true, useValue: [] },
|
|
120
120
|
], imports: [RouterModule] });
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RouterTestingModule, decorators: [{
|
|
122
122
|
type: NgModule,
|
|
123
123
|
args: [{
|
|
124
124
|
exports: [RouterModule],
|
|
@@ -148,17 +148,17 @@ class RootFixtureService {
|
|
|
148
148
|
return this.fixture;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
RootFixtureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-
|
|
152
|
-
RootFixtureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.0-
|
|
153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-
|
|
151
|
+
RootFixtureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
152
|
+
RootFixtureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RootFixtureService, providedIn: 'root' });
|
|
153
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RootFixtureService, decorators: [{
|
|
154
154
|
type: Injectable,
|
|
155
155
|
args: [{ providedIn: 'root' }]
|
|
156
156
|
}] });
|
|
157
157
|
class RootCmp {
|
|
158
158
|
}
|
|
159
|
-
RootCmp.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-
|
|
160
|
-
RootCmp.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0-
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-
|
|
159
|
+
RootCmp.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
160
|
+
RootCmp.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.0-rc.0", 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"] }] });
|
|
161
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0-rc.0", ngImport: i0, type: RootCmp, decorators: [{
|
|
162
162
|
type: Component,
|
|
163
163
|
args: [{
|
|
164
164
|
standalone: true,
|
package/fesm2020/upgrade.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.2.0-
|
|
2
|
+
* @license Angular v15.2.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -298,23 +298,6 @@ export declare abstract class BaseRouteReuseStrategy implements RouteReuseStrate
|
|
|
298
298
|
* class AppModule {}
|
|
299
299
|
* ```
|
|
300
300
|
*
|
|
301
|
-
* You can alternatively provide an in-line function with the `CanActivateFn` signature:
|
|
302
|
-
*
|
|
303
|
-
* ```
|
|
304
|
-
* @NgModule({
|
|
305
|
-
* imports: [
|
|
306
|
-
* RouterModule.forRoot([
|
|
307
|
-
* {
|
|
308
|
-
* path: 'team/:id',
|
|
309
|
-
* component: TeamComponent,
|
|
310
|
-
* canActivate: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true]
|
|
311
|
-
* }
|
|
312
|
-
* ])
|
|
313
|
-
* ],
|
|
314
|
-
* })
|
|
315
|
-
* class AppModule {}
|
|
316
|
-
* ```
|
|
317
|
-
*
|
|
318
301
|
* @publicApi
|
|
319
302
|
* @deprecated Use plain JavaScript functions instead.
|
|
320
303
|
* @see CanActivateFn
|
|
@@ -379,30 +362,10 @@ export declare interface CanActivate {
|
|
|
379
362
|
* class AppModule {}
|
|
380
363
|
* ```
|
|
381
364
|
*
|
|
382
|
-
* You can alternatively provide an in-line function with the `CanActivateChildFn` signature:
|
|
383
|
-
*
|
|
384
|
-
* ```
|
|
385
|
-
* @NgModule({
|
|
386
|
-
* imports: [
|
|
387
|
-
* RouterModule.forRoot([
|
|
388
|
-
* {
|
|
389
|
-
* path: 'root',
|
|
390
|
-
* canActivateChild: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => true],
|
|
391
|
-
* children: [
|
|
392
|
-
* {
|
|
393
|
-
* path: 'team/:id',
|
|
394
|
-
* component: TeamComponent
|
|
395
|
-
* }
|
|
396
|
-
* ]
|
|
397
|
-
* }
|
|
398
|
-
* ])
|
|
399
|
-
* ],
|
|
400
|
-
* })
|
|
401
|
-
* class AppModule {}
|
|
402
|
-
* ```
|
|
403
|
-
*
|
|
404
365
|
* @publicApi
|
|
405
|
-
* @deprecated
|
|
366
|
+
* @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
|
|
367
|
+
* injectable class can be used as a functional guard using the `inject` function:
|
|
368
|
+
* `canActivateChild: [() => inject(myGuard).canActivateChild()]`.
|
|
406
369
|
* @see CanActivateChildFn
|
|
407
370
|
*/
|
|
408
371
|
export declare interface CanActivateChild {
|
|
@@ -412,8 +375,16 @@ export declare interface CanActivateChild {
|
|
|
412
375
|
/**
|
|
413
376
|
* The signature of a function used as a `canActivateChild` guard on a `Route`.
|
|
414
377
|
*
|
|
378
|
+
* If all guards return `true`, navigation continues. If any guard returns `false`,
|
|
379
|
+
* navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
|
|
380
|
+
* is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
|
|
381
|
+
*
|
|
382
|
+
* The following example implements a `canActivate` function that checks whether the
|
|
383
|
+
* current user has permission to activate the requested route.
|
|
384
|
+
*
|
|
385
|
+
* {@example router/route_functional_guards.ts region="CanActivateChildFn"}
|
|
386
|
+
*
|
|
415
387
|
* @publicApi
|
|
416
|
-
* @see `CanActivateChild`
|
|
417
388
|
* @see `Route`
|
|
418
389
|
*/
|
|
419
390
|
export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
@@ -421,8 +392,21 @@ export declare type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, st
|
|
|
421
392
|
/**
|
|
422
393
|
* The signature of a function used as a `canActivate` guard on a `Route`.
|
|
423
394
|
*
|
|
395
|
+
* If all guards return `true`, navigation continues. If any guard returns `false`,
|
|
396
|
+
* navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
|
|
397
|
+
* is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
|
|
398
|
+
*
|
|
399
|
+
* The following example implements and uses a `CanActivateChildFn` that checks whether the
|
|
400
|
+
* current user has permission to activate the requested route.
|
|
401
|
+
*
|
|
402
|
+
* {@example router/route_functional_guards.ts region="CanActivateFn"}
|
|
403
|
+
|
|
404
|
+
* Here, the defined guard function is provided as part of the `Route` object
|
|
405
|
+
* in the router configuration:
|
|
406
|
+
|
|
407
|
+
* {@example router/route_functional_guards.ts region="CanActivateFnInRoute"}
|
|
408
|
+
*
|
|
424
409
|
* @publicApi
|
|
425
|
-
* @see `CanActivate`
|
|
426
410
|
* @see `Route`
|
|
427
411
|
*/
|
|
428
412
|
export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
@@ -481,26 +465,10 @@ export declare type CanActivateFn = (route: ActivatedRouteSnapshot, state: Route
|
|
|
481
465
|
* class AppModule {}
|
|
482
466
|
* ```
|
|
483
467
|
*
|
|
484
|
-
* You can alternatively provide an in-line function with the `CanDeactivateFn` signature:
|
|
485
|
-
*
|
|
486
|
-
* ```
|
|
487
|
-
* @NgModule({
|
|
488
|
-
* imports: [
|
|
489
|
-
* RouterModule.forRoot([
|
|
490
|
-
* {
|
|
491
|
-
* path: 'team/:id',
|
|
492
|
-
* component: TeamComponent,
|
|
493
|
-
* canDeactivate: [(component: TeamComponent, currentRoute: ActivatedRouteSnapshot,
|
|
494
|
-
* currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => true]
|
|
495
|
-
* }
|
|
496
|
-
* ])
|
|
497
|
-
* ],
|
|
498
|
-
* })
|
|
499
|
-
* class AppModule {}
|
|
500
|
-
* ```
|
|
501
|
-
*
|
|
502
468
|
* @publicApi
|
|
503
|
-
* @deprecated
|
|
469
|
+
* @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
|
|
470
|
+
* injectable class can be used as a functional guard using the `inject` function:
|
|
471
|
+
* `canDeactivate: [() => inject(myGuard).canDeactivate()]`.
|
|
504
472
|
* @see CanDeactivateFn
|
|
505
473
|
*/
|
|
506
474
|
export declare interface CanDeactivate<T> {
|
|
@@ -510,8 +478,16 @@ export declare interface CanDeactivate<T> {
|
|
|
510
478
|
/**
|
|
511
479
|
* The signature of a function used as a `canDeactivate` guard on a `Route`.
|
|
512
480
|
*
|
|
481
|
+
* If all guards return `true`, navigation continues. If any guard returns `false`,
|
|
482
|
+
* navigation is cancelled. If any guard returns a `UrlTree`, the current navigation
|
|
483
|
+
* is cancelled and a new navigation begins to the `UrlTree` returned from the guard.
|
|
484
|
+
*
|
|
485
|
+
* The following example implements and uses a `CanDeactivateFn` that checks whether the
|
|
486
|
+
* user component has unsaved changes before navigating away from the route.
|
|
487
|
+
*
|
|
488
|
+
* {@example router/route_functional_guards.ts region="CanDeactivateFn"}
|
|
489
|
+
*
|
|
513
490
|
* @publicApi
|
|
514
|
-
* @see `CanDeactivate`
|
|
515
491
|
* @see `Route`
|
|
516
492
|
*/
|
|
517
493
|
export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
@@ -567,24 +543,6 @@ export declare type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedR
|
|
|
567
543
|
* class AppModule {}
|
|
568
544
|
* ```
|
|
569
545
|
*
|
|
570
|
-
* You can alternatively provide an in-line function with the `CanLoadFn` signature:
|
|
571
|
-
*
|
|
572
|
-
* ```
|
|
573
|
-
* @NgModule({
|
|
574
|
-
* imports: [
|
|
575
|
-
* RouterModule.forRoot([
|
|
576
|
-
* {
|
|
577
|
-
* path: 'team/:id',
|
|
578
|
-
* component: TeamComponent,
|
|
579
|
-
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
580
|
-
* canLoad: [(route: Route, segments: UrlSegment[]) => true]
|
|
581
|
-
* }
|
|
582
|
-
* ])
|
|
583
|
-
* ],
|
|
584
|
-
* })
|
|
585
|
-
* class AppModule {}
|
|
586
|
-
* ```
|
|
587
|
-
*
|
|
588
546
|
* @publicApi
|
|
589
547
|
* @deprecated Use `CanMatchFn` instead
|
|
590
548
|
*/
|
|
@@ -662,30 +620,10 @@ export declare type CanLoadFn = (route: Route, segments: UrlSegment[]) => Observ
|
|
|
662
620
|
* `team/:id` URL, but would load the `NotFoundComponent` because the `Route` for `'team/:id'`
|
|
663
621
|
* could not be used for a URL match but the catch-all `**` `Route` did instead.
|
|
664
622
|
*
|
|
665
|
-
* You can alternatively provide an in-line function with the `CanMatchFn` signature:
|
|
666
|
-
*
|
|
667
|
-
* ```
|
|
668
|
-
* @NgModule({
|
|
669
|
-
* imports: [
|
|
670
|
-
* RouterModule.forRoot([
|
|
671
|
-
* {
|
|
672
|
-
* path: 'team/:id',
|
|
673
|
-
* component: TeamComponent,
|
|
674
|
-
* loadChildren: () => import('./team').then(mod => mod.TeamModule),
|
|
675
|
-
* canMatch: [(route: Route, segments: UrlSegment[]) => true]
|
|
676
|
-
* },
|
|
677
|
-
* {
|
|
678
|
-
* path: '**',
|
|
679
|
-
* component: NotFoundComponent
|
|
680
|
-
* }
|
|
681
|
-
* ])
|
|
682
|
-
* ],
|
|
683
|
-
* })
|
|
684
|
-
* class AppModule {}
|
|
685
|
-
* ```
|
|
686
|
-
*
|
|
687
623
|
* @publicApi
|
|
688
|
-
* @deprecated
|
|
624
|
+
* @deprecated Class-based `Route` guards are deprecated in favor of functional guards. An
|
|
625
|
+
* injectable class can be used as a functional guard using the `inject` function:
|
|
626
|
+
* `canMatch: [() => inject(myGuard).canMatch()]`.
|
|
689
627
|
* @see CanMatchFn
|
|
690
628
|
*/
|
|
691
629
|
export declare interface CanMatch {
|
|
@@ -693,10 +631,18 @@ export declare interface CanMatch {
|
|
|
693
631
|
}
|
|
694
632
|
|
|
695
633
|
/**
|
|
696
|
-
* The signature of a function used as a `
|
|
634
|
+
* The signature of a function used as a `canMatch` guard on a `Route`.
|
|
635
|
+
*
|
|
636
|
+
* If all guards return `true`, navigation continues and the `Router` will use the `Route` during
|
|
637
|
+
* activation. If any guard returns `false`, the `Route` is skipped for matching and other `Route`
|
|
638
|
+
* configurations are processed instead.
|
|
639
|
+
*
|
|
640
|
+
* The following example implements and uses a `CanMatchFn` that checks whether the
|
|
641
|
+
* current user has permission to access the team page.
|
|
642
|
+
*
|
|
643
|
+
* {@example router/route_functional_guards.ts region="CanMatchFn"}
|
|
697
644
|
*
|
|
698
645
|
* @publicApi
|
|
699
|
-
* @see `CanMatch`
|
|
700
646
|
* @see `Route`
|
|
701
647
|
*/
|
|
702
648
|
export declare type CanMatchFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
|
@@ -924,7 +870,8 @@ export declare class DefaultUrlSerializer implements UrlSerializer {
|
|
|
924
870
|
/**
|
|
925
871
|
* The `InjectionToken` and `@Injectable` classes for guards and resolvers are deprecated in favor
|
|
926
872
|
* of plain JavaScript functions instead.. Dependency injection can still be achieved using the
|
|
927
|
-
* `inject` function from `@angular/core
|
|
873
|
+
* `inject` function from `@angular/core` and an injectable class can be used as a functional guard
|
|
874
|
+
* using `inject`: `canActivate: [() => inject(myGuard).canActivate()]`.
|
|
928
875
|
*
|
|
929
876
|
* @deprecated
|
|
930
877
|
* @see CanMatchFn
|
|
@@ -2057,29 +2004,6 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
|
2057
2004
|
* export class AppRoutingModule {}
|
|
2058
2005
|
* ```
|
|
2059
2006
|
*
|
|
2060
|
-
* You can alternatively provide an in-line function with the `ResolveFn` signature:
|
|
2061
|
-
*
|
|
2062
|
-
* ```
|
|
2063
|
-
* export const myHero: Hero = {
|
|
2064
|
-
* // ...
|
|
2065
|
-
* }
|
|
2066
|
-
*
|
|
2067
|
-
* @NgModule({
|
|
2068
|
-
* imports: [
|
|
2069
|
-
* RouterModule.forRoot([
|
|
2070
|
-
* {
|
|
2071
|
-
* path: 'detail/:id',
|
|
2072
|
-
* component: HeroComponent,
|
|
2073
|
-
* resolve: {
|
|
2074
|
-
* hero: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => myHero
|
|
2075
|
-
* }
|
|
2076
|
-
* }
|
|
2077
|
-
* ])
|
|
2078
|
-
* ],
|
|
2079
|
-
* })
|
|
2080
|
-
* export class AppModule {}
|
|
2081
|
-
* ```
|
|
2082
|
-
*
|
|
2083
2007
|
* And you can access to your resolved data from `HeroComponent`:
|
|
2084
2008
|
*
|
|
2085
2009
|
* ```
|
|
@@ -2124,7 +2048,9 @@ export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
|
2124
2048
|
* The order of execution is: BaseGuard, ChildGuard, BaseDataResolver, ChildDataResolver.
|
|
2125
2049
|
*
|
|
2126
2050
|
* @publicApi
|
|
2127
|
-
* @deprecated
|
|
2051
|
+
* @deprecated Class-based `Route` resolvers are deprecated in favor of functional resolvers. An
|
|
2052
|
+
* injectable class can be used as a functional guard using the `inject` function: `resolve:
|
|
2053
|
+
* {'user': () => inject(UserResolver).resolve()}`.
|
|
2128
2054
|
* @see ResolveFn
|
|
2129
2055
|
*/
|
|
2130
2056
|
export declare interface Resolve<T> {
|
|
@@ -2169,9 +2095,44 @@ export declare class ResolveEnd extends RouterEvent {
|
|
|
2169
2095
|
|
|
2170
2096
|
/**
|
|
2171
2097
|
* Function type definition for a data provider.
|
|
2098
|
+
|
|
2099
|
+
* A data provider can be used with the router to resolve data during navigation.
|
|
2100
|
+
* The router waits for the data to be resolved before the route is finally activated.
|
|
2101
|
+
*
|
|
2102
|
+
* The following example implements a function that retrieves the data
|
|
2103
|
+
* needed to activate the requested route.
|
|
2104
|
+
*
|
|
2105
|
+
* {@example router/route_functional_guards.ts region="ResolveFn"}
|
|
2106
|
+
*
|
|
2107
|
+
* And you can access to your resolved data from `HeroComponent`:
|
|
2108
|
+
*
|
|
2109
|
+
* {@example router/route_functional_guards.ts region="ResolveDataUse"}
|
|
2110
|
+
*
|
|
2111
|
+
* @usageNotes
|
|
2112
|
+
*
|
|
2113
|
+
* When both guard and resolvers are specified, the resolvers are not executed until
|
|
2114
|
+
* all guards have run and succeeded.
|
|
2115
|
+
* For example, consider the following route configuration:
|
|
2116
|
+
*
|
|
2117
|
+
* ```
|
|
2118
|
+
* {
|
|
2119
|
+
* path: 'base'
|
|
2120
|
+
* canActivate: [baseGuard],
|
|
2121
|
+
* resolve: {data: baseDataResolver}
|
|
2122
|
+
* children: [
|
|
2123
|
+
* {
|
|
2124
|
+
* path: 'child',
|
|
2125
|
+
* canActivate: [childGuard],
|
|
2126
|
+
* component: ChildComponent,
|
|
2127
|
+
* resolve: {childData: childDataResolver}
|
|
2128
|
+
* }
|
|
2129
|
+
* ]
|
|
2130
|
+
* }
|
|
2131
|
+
* ```
|
|
2132
|
+
* The order of execution is: baseGuard, childGuard, baseDataResolver, childDataResolver.
|
|
2172
2133
|
*
|
|
2173
|
-
* @see `Route#resolve`.
|
|
2174
2134
|
* @publicApi
|
|
2135
|
+
* @see Route
|
|
2175
2136
|
*/
|
|
2176
2137
|
export declare type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => Observable<T> | Promise<T> | T;
|
|
2177
2138
|
|
|
@@ -2664,8 +2625,8 @@ export declare class Router {
|
|
|
2664
2625
|
* A handler for navigation errors in this NgModule.
|
|
2665
2626
|
*
|
|
2666
2627
|
* @deprecated Subscribe to the `Router` events and watch for `NavigationError` instead.
|
|
2667
|
-
* `provideRouter` has the `
|
|
2668
|
-
* @see `
|
|
2628
|
+
* `provideRouter` has the `withNavigationErrorHandler` feature to make this easier.
|
|
2629
|
+
* @see `withNavigationErrorHandler`
|
|
2669
2630
|
*/
|
|
2670
2631
|
errorHandler: (error: any) => any;
|
|
2671
2632
|
/**
|
|
@@ -4480,7 +4441,7 @@ export declare function withInMemoryScrolling(options?: InMemoryScrollingOptions
|
|
|
4480
4441
|
* {
|
|
4481
4442
|
* providers: [
|
|
4482
4443
|
* provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) =>
|
|
4483
|
-
* inject(MyErrorTracker).trackError(e))
|
|
4444
|
+
* inject(MyErrorTracker).trackError(e)))
|
|
4484
4445
|
* ]
|
|
4485
4446
|
* }
|
|
4486
4447
|
* );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/router",
|
|
3
|
-
"version": "15.2.0-
|
|
3
|
+
"version": "15.2.0-rc.0",
|
|
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": "15.2.0-
|
|
28
|
-
"@angular/common": "15.2.0-
|
|
29
|
-
"@angular/platform-browser": "15.2.0-
|
|
27
|
+
"@angular/core": "15.2.0-rc.0",
|
|
28
|
+
"@angular/common": "15.2.0-rc.0",
|
|
29
|
+
"@angular/platform-browser": "15.2.0-rc.0",
|
|
30
30
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
31
31
|
},
|
|
32
32
|
"ng-update": {
|
package/testing/index.d.ts
CHANGED
package/upgrade/index.d.ts
CHANGED