-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathindex.d.ts
executable file
·922 lines (908 loc) · 33.6 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
/**
* @license Angular v20.0.0-next.4+sha-916f768
* (c) 2010-2025 Google LLC. https://angular.io/
* License: MIT
*/
import { A as ActivatedRouteSnapshot, P as Params, U as UrlTree, R as RouterOutletContract, a as ActivatedRoute, b as RouterStateSnapshot, c as Route, L as LoadedRouterConfig, d as Router, e as Routes, I as InMemoryScrollingOptions, N as NavigationError, f as RedirectCommand, g as RouterConfigOptions, C as CanActivate, h as CanActivateFn, i as CanActivateChild, j as CanActivateChildFn, k as CanDeactivate, l as CanDeactivateFn, m as CanMatch, n as CanMatchFn, o as Resolve, p as ResolveFn, E as Event } from './router_module.d-DYN7Vo-M.js';
export { u as ActivationEnd, v as ActivationStart, ae as BaseRouteReuseStrategy, aa as CanLoad, Z as CanLoadFn, w as ChildActivationEnd, x as ChildActivationStart, _ as Data, $ as DefaultExport, ar as DefaultUrlSerializer, aw as DeprecatedGuard, ax as DeprecatedResolve, af as DetachedRouteHandle, y as EventType, ah as ExtraOptions, Y as GuardResult, G as GuardsCheckEnd, z as GuardsCheckStart, ai as InitialNavigation, as as IsActiveMatchOptions, a0 as LoadChildren, a1 as LoadChildrenCallback, X as MaybeAsync, ab as Navigation, a2 as NavigationBehaviorOptions, B as NavigationCancel, D as NavigationCancellationCode, F as NavigationEnd, ac as NavigationExtras, H as NavigationSkipped, J as NavigationSkippedCode, K as NavigationStart, a3 as OnSameUrlNavigation, aq as PRIMARY_OUTLET, ap as ParamMap, a4 as QueryParamsHandling, aj as ROUTER_CONFIGURATION, ak as ROUTER_INITIALIZER, t as ROUTER_OUTLET_DATA, a5 as RedirectFunction, a6 as ResolveData, M as ResolveEnd, O as ResolveStart, Q as RouteConfigLoadEnd, S as RouteConfigLoadStart, ag as RouteReuseStrategy, T as RouterEvent, q as RouterLink, r as RouterLinkActive, q as RouterLinkWithHref, al as RouterModule, s as RouterOutlet, am as RouterState, V as RoutesRecognized, a7 as RunGuardsAndResolvers, W as Scroll, ad as UrlCreationOptions, a9 as UrlMatchResult, a8 as UrlMatcher, at as UrlSegment, au as UrlSegmentGroup, av as UrlSerializer, an as convertToParamMap, ao as defaultUrlMatcher, ɵ as ɵEmptyOutletComponent, az as ɵROUTER_PROVIDERS, ay as ɵRestoredState } from './router_module.d-DYN7Vo-M.js';
import { Title } from '@angular/platform-browser';
import * as i0 from '@angular/core';
import { EnvironmentInjector, ComponentRef, InjectionToken, Type, Injector, Compiler, OnDestroy, Provider, EnvironmentProviders, Version } from '@angular/core';
import { Observable } from 'rxjs';
import '@angular/common';
import '@angular/router';
/**
* Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
*
* @publicApi
*
*
* @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to
* @param commands An array of URL fragments with which to construct the new URL tree.
* If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
* segments, followed by the parameters for each segment.
* The fragments are applied to the one provided in the `relativeTo` parameter.
* @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have
* any query parameters.
* @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.
*
* @usageNotes
*
* ```ts
* // create /team/33/user/11
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);
*
* // create /team/33;expand=true/user/11
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);
*
* // you can collapse static segments like this (this works only with the first passed-in value):
* createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);
*
* // If the first segment can contain slashes, and you do not want the router to split it,
* // you can do the following:
* createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);
*
* // create /team/33/(user/11//right:chat)
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:
* 'chat'}}], null, null);
*
* // remove the right secondary node
* createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
*
* // For the examples below, assume the current URL is for the `/team/33/user/11` and the
* `ActivatedRouteSnapshot` points to `user/11`:
*
* // navigate to /team/33/user/11/details
* createUrlTreeFromSnapshot(snapshot, ['details']);
*
* // navigate to /team/33/user/22
* createUrlTreeFromSnapshot(snapshot, ['../22']);
*
* // navigate to /team/44/user/22
* createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);
* ```
*/
declare function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: any[], queryParams?: Params | null, fragment?: string | null): UrlTree;
/**
* Store contextual information about a `RouterOutlet`
*
* @publicApi
*/
declare class OutletContext {
private readonly rootInjector;
outlet: RouterOutletContract | null;
route: ActivatedRoute | null;
children: ChildrenOutletContexts;
attachRef: ComponentRef<any> | null;
get injector(): EnvironmentInjector;
constructor(rootInjector: EnvironmentInjector);
}
/**
* Store contextual information about the children (= nested) `RouterOutlet`
*
* @publicApi
*/
declare class ChildrenOutletContexts {
private rootInjector;
private contexts;
/** @nodoc */
constructor(rootInjector: EnvironmentInjector);
/** Called when a `RouterOutlet` directive is instantiated */
onChildOutletCreated(childName: string, outlet: RouterOutletContract): void;
/**
* Called when a `RouterOutlet` directive is destroyed.
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
* re-created later.
*/
onChildOutletDestroyed(childName: string): void;
/**
* Called when the corresponding route is deactivated during navigation.
* Because the component get destroyed, all children outlet are destroyed.
*/
onOutletDeactivated(): Map<string, OutletContext>;
onOutletReAttached(contexts: Map<string, OutletContext>): void;
getOrCreateContext(childName: string): OutletContext;
getContext(childName: string): OutletContext | null;
static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>;
}
/**
* Options to configure the View Transitions integration in the Router.
*
* @experimental
* @publicApi
* @see withViewTransitions
*/
interface ViewTransitionsFeatureOptions {
/**
* Skips the very first call to `startViewTransition`. This can be useful for disabling the
* animation during the application's initial loading phase.
*/
skipInitialTransition?: boolean;
/**
* A function to run after the `ViewTransition` is created.
*
* This function is run in an injection context and can use `inject`.
*/
onViewTransitionCreated?: (transitionInfo: ViewTransitionInfo) => void;
}
/**
* The information passed to the `onViewTransitionCreated` function provided in the
* `withViewTransitions` feature options.
*
* @publicApi
* @experimental
*/
interface ViewTransitionInfo {
/**
* The `ViewTransition` returned by the call to `startViewTransition`.
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
*/
transition: {
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/finished
*/
finished: Promise<void>;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/ready
*/
ready: Promise<void>;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/updateCallbackDone
*/
updateCallbackDone: Promise<void>;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition/skipTransition
*/
skipTransition(): void;
/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition#browser_compatibility
* @see https://developer.chrome.com/docs/web-platform/view-transitions/same-document#default_style_and_transition_reference
*/
readonly types: Set<string>;
};
/**
* The `ActivatedRouteSnapshot` that the navigation is transitioning from.
*/
from: ActivatedRouteSnapshot;
/**
* The `ActivatedRouteSnapshot` that the navigation is transitioning to.
*/
to: ActivatedRouteSnapshot;
}
/**
* Provides a strategy for setting the page title after a router navigation.
*
* The built-in implementation traverses the router state snapshot and finds the deepest primary
* outlet with `title` property. Given the `Routes` below, navigating to
* `/base/child(popup:aux)` would result in the document title being set to "child".
* ```ts
* [
* {path: 'base', title: 'base', children: [
* {path: 'child', title: 'child'},
* ],
* {path: 'aux', outlet: 'popup', title: 'popupTitle'}
* ]
* ```
*
* This class can be used as a base class for custom title strategies. That is, you can create your
* own class that extends the `TitleStrategy`. Note that in the above example, the `title`
* from the named outlet is never used. However, a custom strategy might be implemented to
* incorporate titles in named outlets.
*
* @publicApi
* @see [Page title guide](guide/routing/common-router-tasks#setting-the-page-title)
*/
declare abstract class TitleStrategy {
/** Performs the application title update. */
abstract updateTitle(snapshot: RouterStateSnapshot): void;
/**
* @returns The `title` of the deepest primary route.
*/
buildTitle(snapshot: RouterStateSnapshot): string | undefined;
/**
* Given an `ActivatedRouteSnapshot`, returns the final value of the
* `Route.title` property, which can either be a static string or a resolved value.
*/
getResolvedTitleForRoute(snapshot: ActivatedRouteSnapshot): any;
static ɵfac: i0.ɵɵFactoryDeclaration<TitleStrategy, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TitleStrategy>;
}
/**
* The default `TitleStrategy` used by the router that updates the title using the `Title` service.
*/
declare class DefaultTitleStrategy extends TitleStrategy {
readonly title: Title;
constructor(title: Title);
/**
* Sets the title of the browser to the given value.
*
* @param title The `pageTitle` from the deepest primary route.
*/
updateTitle(snapshot: RouterStateSnapshot): void;
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultTitleStrategy, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTitleStrategy>;
}
/**
* The DI token for a router configuration.
*
* `ROUTES` is a low level API for router configuration via dependency injection.
*
* We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
* `provideRouter`, or `Router.resetConfig()`.
*
* @publicApi
*/
declare const ROUTES: InjectionToken<Route[][]>;
declare class RouterConfigLoader {
private componentLoaders;
private childrenLoaders;
onLoadStartListener?: (r: Route) => void;
onLoadEndListener?: (r: Route) => void;
private readonly compiler;
loadComponent(route: Route): Observable<Type<unknown>>;
loadChildren(parentInjector: Injector, route: Route): Observable<LoadedRouterConfig>;
static ɵfac: i0.ɵɵFactoryDeclaration<RouterConfigLoader, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RouterConfigLoader>;
}
/**
* Executes a `route.loadChildren` callback and converts the result to an array of child routes and
* an injector if that callback returned a module.
*
* This function is used for the route discovery during prerendering
* in @angular-devkit/build-angular. If there are any updates to the contract here, it will require
* an update to the extractor.
*/
declare function loadChildren(route: Route, compiler: Compiler, parentInjector: Injector, onLoadEndListener?: (r: Route) => void): Observable<LoadedRouterConfig>;
/**
* @description
*
* Provides a preloading strategy.
*
* @publicApi
*/
declare abstract class PreloadingStrategy {
abstract preload(route: Route, fn: () => Observable<any>): Observable<any>;
}
/**
* @description
*
* Provides a preloading strategy that preloads all modules as quickly as possible.
*
* ```ts
* RouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})
* ```
*
* @publicApi
*/
declare class PreloadAllModules implements PreloadingStrategy {
preload(route: Route, fn: () => Observable<any>): Observable<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<PreloadAllModules, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PreloadAllModules>;
}
/**
* @description
*
* Provides a preloading strategy that does not preload any modules.
*
* This strategy is enabled by default.
*
* @publicApi
*/
declare class NoPreloading implements PreloadingStrategy {
preload(route: Route, fn: () => Observable<any>): Observable<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<NoPreloading, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<NoPreloading>;
}
/**
* The preloader optimistically loads all router configurations to
* make navigations into lazily-loaded sections of the application faster.
*
* The preloader runs in the background. When the router bootstraps, the preloader
* starts listening to all navigation events. After every such event, the preloader
* will check if any configurations can be loaded lazily.
*
* If a route is protected by `canLoad` guards, the preloaded will not load it.
*
* @publicApi
*/
declare class RouterPreloader implements OnDestroy {
private router;
private injector;
private preloadingStrategy;
private loader;
private subscription?;
constructor(router: Router, compiler: Compiler, injector: EnvironmentInjector, preloadingStrategy: PreloadingStrategy, loader: RouterConfigLoader);
setUpPreloading(): void;
preload(): Observable<any>;
/** @nodoc */
ngOnDestroy(): void;
private processRoutes;
private preloadConfig;
static ɵfac: i0.ɵɵFactoryDeclaration<RouterPreloader, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RouterPreloader>;
}
/**
* Sets up providers necessary to enable `Router` functionality for the application.
* Allows to configure a set of routes as well as extra features that should be enabled.
*
* @usageNotes
*
* Basic example of how you can add a Router to your application:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent, {
* providers: [provideRouter(appRoutes)]
* });
* ```
*
* You can also enable optional features in the Router by adding functions from the `RouterFeatures`
* type:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes,
* withDebugTracing(),
* withRouterConfig({paramsInheritanceStrategy: 'always'}))
* ]
* }
* );
* ```
*
* @see {@link RouterFeatures}
*
* @publicApi
* @param routes A set of `Route`s to use for the application routing table.
* @param features Optional features to configure additional router behaviors.
* @returns A set of providers to setup a Router.
*/
declare function provideRouter(routes: Routes, ...features: RouterFeatures[]): EnvironmentProviders;
/**
* Helper type to represent a Router feature.
*
* @publicApi
*/
interface RouterFeature<FeatureKind extends RouterFeatureKind> {
ɵkind: FeatureKind;
ɵproviders: Provider[];
}
/**
* Registers a DI provider for a set of routes.
* @param routes The route configuration to provide.
*
* @usageNotes
*
* ```ts
* @NgModule({
* providers: [provideRoutes(ROUTES)]
* })
* class LazyLoadedChildModule {}
* ```
*
* @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`.
* @see {@link ROUTES}
* @publicApi
*/
declare function provideRoutes(routes: Routes): Provider[];
/**
* A type alias for providers returned by `withInMemoryScrolling` for use with `provideRouter`.
*
* @see {@link withInMemoryScrolling}
* @see {@link provideRouter}
*
* @publicApi
*/
type InMemoryScrollingFeature = RouterFeature<RouterFeatureKind.InMemoryScrollingFeature>;
/**
* Enables customizable scrolling behavior for router navigations.
*
* @usageNotes
*
* Basic example of how you can enable scrolling feature:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withInMemoryScrolling())
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
* @see {@link ViewportScroller}
*
* @publicApi
* @param options Set of configuration parameters to customize scrolling behavior, see
* `InMemoryScrollingOptions` for additional information.
* @returns A set of providers for use with `provideRouter`.
*/
declare function withInMemoryScrolling(options?: InMemoryScrollingOptions): InMemoryScrollingFeature;
/**
* A type alias for providers returned by `withEnabledBlockingInitialNavigation` for use with
* `provideRouter`.
*
* @see {@link withEnabledBlockingInitialNavigation}
* @see {@link provideRouter}
*
* @publicApi
*/
type EnabledBlockingInitialNavigationFeature = RouterFeature<RouterFeatureKind.EnabledBlockingInitialNavigationFeature>;
/**
* A type alias for providers returned by `withEnabledBlockingInitialNavigation` or
* `withDisabledInitialNavigation` functions for use with `provideRouter`.
*
* @see {@link withEnabledBlockingInitialNavigation}
* @see {@link withDisabledInitialNavigation}
* @see {@link provideRouter}
*
* @publicApi
*/
type InitialNavigationFeature = EnabledBlockingInitialNavigationFeature | DisabledInitialNavigationFeature;
/**
* Configures initial navigation to start before the root component is created.
*
* The bootstrap is blocked until the initial navigation is complete. This should be set in case
* you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration) for
* your application.
*
* @usageNotes
*
* Basic example of how you can enable this navigation behavior:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
*
* @publicApi
* @returns A set of providers for use with `provideRouter`.
*/
declare function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNavigationFeature;
/**
* A type alias for providers returned by `withDisabledInitialNavigation` for use with
* `provideRouter`.
*
* @see {@link withDisabledInitialNavigation}
* @see {@link provideRouter}
*
* @publicApi
*/
type DisabledInitialNavigationFeature = RouterFeature<RouterFeatureKind.DisabledInitialNavigationFeature>;
/**
* Disables initial navigation.
*
* Use if there is a reason to have more control over when the router starts its initial navigation
* due to some complex initialization logic.
*
* @usageNotes
*
* Basic example of how you can disable initial navigation:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withDisabledInitialNavigation())
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
*
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withDisabledInitialNavigation(): DisabledInitialNavigationFeature;
/**
* A type alias for providers returned by `withDebugTracing` for use with `provideRouter`.
*
* @see {@link withDebugTracing}
* @see {@link provideRouter}
*
* @publicApi
*/
type DebugTracingFeature = RouterFeature<RouterFeatureKind.DebugTracingFeature>;
/**
* Enables logging of all internal navigation events to the console.
* Extra logging might be useful for debugging purposes to inspect Router event sequence.
*
* @usageNotes
*
* Basic example of how you can enable debug tracing:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withDebugTracing())
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
*
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withDebugTracing(): DebugTracingFeature;
/**
* A type alias that represents a feature which enables preloading in Router.
* The type is used to describe the return value of the `withPreloading` function.
*
* @see {@link withPreloading}
* @see {@link provideRouter}
*
* @publicApi
*/
type PreloadingFeature = RouterFeature<RouterFeatureKind.PreloadingFeature>;
/**
* Allows to configure a preloading strategy to use. The strategy is configured by providing a
* reference to a class that implements a `PreloadingStrategy`.
*
* @usageNotes
*
* Basic example of how you can configure preloading:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withPreloading(PreloadAllModules))
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
*
* @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
* should be used.
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withPreloading(preloadingStrategy: Type<PreloadingStrategy>): PreloadingFeature;
/**
* A type alias for providers returned by `withRouterConfig` for use with `provideRouter`.
*
* @see {@link withRouterConfig}
* @see {@link provideRouter}
*
* @publicApi
*/
type RouterConfigurationFeature = RouterFeature<RouterFeatureKind.RouterConfigurationFeature>;
/**
* Allows to provide extra parameters to configure Router.
*
* @usageNotes
*
* Basic example of how you can provide extra configuration options:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withRouterConfig({
* onSameUrlNavigation: 'reload'
* }))
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
*
* @param options A set of parameters to configure Router, see `RouterConfigOptions` for
* additional information.
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withRouterConfig(options: RouterConfigOptions): RouterConfigurationFeature;
/**
* A type alias for providers returned by `withHashLocation` for use with `provideRouter`.
*
* @see {@link withHashLocation}
* @see {@link provideRouter}
*
* @publicApi
*/
type RouterHashLocationFeature = RouterFeature<RouterFeatureKind.RouterHashLocationFeature>;
/**
* Provides the location strategy that uses the URL fragment instead of the history API.
*
* @usageNotes
*
* Basic example of how you can use the hash location option:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withHashLocation())
* ]
* }
* );
* ```
*
* @see {@link provideRouter}
* @see {@link /api/common/HashLocationStrategy HashLocationStrategy}
*
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withHashLocation(): RouterHashLocationFeature;
/**
* A type alias for providers returned by `withNavigationErrorHandler` for use with `provideRouter`.
*
* @see {@link withNavigationErrorHandler}
* @see {@link provideRouter}
*
* @publicApi
*/
type NavigationErrorHandlerFeature = RouterFeature<RouterFeatureKind.NavigationErrorHandlerFeature>;
/**
* Provides a function which is called when a navigation error occurs.
*
* This function is run inside application's [injection context](guide/di/dependency-injection-context)
* so you can use the [`inject`](api/core/inject) function.
*
* This function can return a `RedirectCommand` to convert the error to a redirect, similar to returning
* a `UrlTree` or `RedirectCommand` from a guard. This will also prevent the `Router` from emitting
* `NavigationError`; it will instead emit `NavigationCancel` with code NavigationCancellationCode.Redirect.
* Return values other than `RedirectCommand` are ignored and do not change any behavior with respect to
* how the `Router` handles the error.
*
* @usageNotes
*
* Basic example of how you can use the error handler option:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) =>
* inject(MyErrorTracker).trackError(e)))
* ]
* }
* );
* ```
*
* @see {@link NavigationError}
* @see {@link /api/core/inject inject}
* @see {@link runInInjectionContext}
*
* @returns A set of providers for use with `provideRouter`.
*
* @publicApi
*/
declare function withNavigationErrorHandler(handler: (error: NavigationError) => unknown | RedirectCommand): NavigationErrorHandlerFeature;
/**
* A type alias for providers returned by `withComponentInputBinding` for use with `provideRouter`.
*
* @see {@link withComponentInputBinding}
* @see {@link provideRouter}
*
* @publicApi
*/
type ComponentInputBindingFeature = RouterFeature<RouterFeatureKind.ComponentInputBindingFeature>;
/**
* A type alias for providers returned by `withViewTransitions` for use with `provideRouter`.
*
* @see {@link withViewTransitions}
* @see {@link provideRouter}
*
* @publicApi
*/
type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFeature>;
/**
* Enables binding information from the `Router` state directly to the inputs of the component in
* `Route` configurations.
*
* @usageNotes
*
* Basic example of how you can enable the feature:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withComponentInputBinding())
* ]
* }
* );
* ```
*
* The router bindings information from any of the following sources:
*
* - query parameters
* - path and matrix parameters
* - static route data
* - data from resolvers
*
* Duplicate keys are resolved in the same order from above, from least to greatest,
* meaning that resolvers have the highest precedence and override any of the other information
* from the route.
*
* Importantly, when an input does not have an item in the route data with a matching key, this
* input is set to `undefined`. This prevents previous information from being
* retained if the data got removed from the route (i.e. if a query parameter is removed).
* Default values can be provided with a resolver on the route to ensure the value is always present
* or an input and use an input transform in the component.
*
* @see {@link /guide/components/inputs#input-transforms Input Transforms}
* @returns A set of providers for use with `provideRouter`.
*/
declare function withComponentInputBinding(): ComponentInputBindingFeature;
/**
* Enables view transitions in the Router by running the route activation and deactivation inside of
* `document.startViewTransition`.
*
* Note: The View Transitions API is not available in all browsers. If the browser does not support
* view transitions, the Router will not attempt to start a view transition and continue processing
* the navigation as usual.
*
* @usageNotes
*
* Basic example of how you can enable the feature:
* ```ts
* const appRoutes: Routes = [];
* bootstrapApplication(AppComponent,
* {
* providers: [
* provideRouter(appRoutes, withViewTransitions())
* ]
* }
* );
* ```
*
* @returns A set of providers for use with `provideRouter`.
* @see https://developer.chrome.com/docs/web-platform/view-transitions/
* @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
* @developerPreview
*/
declare function withViewTransitions(options?: ViewTransitionsFeatureOptions): ViewTransitionsFeature;
/**
* A type alias that represents all Router features available for use with `provideRouter`.
* Features can be enabled by adding special functions to the `provideRouter` call.
* See documentation for each symbol to find corresponding function name. See also `provideRouter`
* documentation on how to use those functions.
*
* @see {@link provideRouter}
*
* @publicApi
*/
type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature | ViewTransitionsFeature | RouterHashLocationFeature;
/**
* The list of features as an enum to uniquely type each feature.
*/
declare const enum RouterFeatureKind {
PreloadingFeature = 0,
DebugTracingFeature = 1,
EnabledBlockingInitialNavigationFeature = 2,
DisabledInitialNavigationFeature = 3,
InMemoryScrollingFeature = 4,
RouterConfigurationFeature = 5,
RouterHashLocationFeature = 6,
NavigationErrorHandlerFeature = 7,
ComponentInputBindingFeature = 8,
ViewTransitionsFeature = 9
}
/**
* @description
*
* Provides a way to migrate AngularJS applications to Angular.
*
* @publicApi
*/
declare abstract class UrlHandlingStrategy {
/**
* Tells the router if this URL should be processed.
*
* When it returns true, the router will execute the regular navigation.
* When it returns false, the router will set the router state to an empty state.
* As a result, all the active components will be destroyed.
*
*/
abstract shouldProcessUrl(url: UrlTree): boolean;
/**
* Extracts the part of the URL that should be handled by the router.
* The rest of the URL will remain untouched.
*/
abstract extract(url: UrlTree): UrlTree;
/**
* Merges the URL fragment with the rest of the URL.
*/
abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree;
static ɵfac: i0.ɵɵFactoryDeclaration<UrlHandlingStrategy, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<UrlHandlingStrategy>;
}
/**
* Maps an array of injectable classes with canMatch functions to an array of equivalent
* `CanMatchFn` for use in a `Route` definition.
*
* Usage {@example router/utils/functional_guards.ts region='CanActivate'}
*
* @publicApi
* @see {@link Route}
*/
declare function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[];
/**
* Maps an array of injectable classes with canActivate functions to an array of equivalent
* `CanActivateFn` for use in a `Route` definition.
*
* Usage {@example router/utils/functional_guards.ts region='CanActivate'}
*
* @publicApi
* @see {@link Route}
*/
declare function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[];
/**
* Maps an array of injectable classes with canActivateChild functions to an array of equivalent
* `CanActivateChildFn` for use in a `Route` definition.
*
* Usage {@example router/utils/functional_guards.ts region='CanActivate'}
*
* @publicApi
* @see {@link Route}
*/
declare function mapToCanActivateChild(providers: Array<Type<CanActivateChild>>): CanActivateChildFn[];
/**
* Maps an array of injectable classes with canDeactivate functions to an array of equivalent
* `CanDeactivateFn` for use in a `Route` definition.
*
* Usage {@example router/utils/functional_guards.ts region='CanActivate'}
*
* @publicApi
* @see {@link Route}
*/
declare function mapToCanDeactivate<T = unknown>(providers: Array<Type<CanDeactivate<T>>>): CanDeactivateFn<T>[];
/**
* Maps an injectable class with a resolve function to an equivalent `ResolveFn`
* for use in a `Route` definition.
*
* Usage {@example router/utils/functional_guards.ts region='Resolve'}
*
* @publicApi
* @see {@link Route}
*/
declare function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T>;
/**
* @module
* @description
* Entry point for all public APIs of the router package.
*/
/**
* @publicApi
*/
declare const VERSION: Version;
/**
* Performs the given action once the router finishes its next/current navigation.
*
* The navigation is considered complete under the following conditions:
* - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or
* `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the
* redirecting/superseding navigation must finish.
* - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits
*/
declare function afterNextNavigation(router: {
events: Observable<Event>;
}, action: () => void): void;
export { ActivatedRoute, ActivatedRouteSnapshot, CanActivate, CanActivateChild, CanActivateChildFn, CanActivateFn, CanDeactivate, CanDeactivateFn, CanMatch, CanMatchFn, ChildrenOutletContexts, DefaultTitleStrategy, Event, InMemoryScrollingOptions, NavigationError, NoPreloading, OutletContext, Params, PreloadAllModules, PreloadingStrategy, ROUTES, RedirectCommand, Resolve, ResolveFn, Route, Router, RouterConfigOptions, RouterOutletContract, RouterPreloader, RouterStateSnapshot, Routes, TitleStrategy, UrlHandlingStrategy, UrlTree, VERSION, createUrlTreeFromSnapshot, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };
export type { ComponentInputBindingFeature, DebugTracingFeature, DisabledInitialNavigationFeature, EnabledBlockingInitialNavigationFeature, InMemoryScrollingFeature, InitialNavigationFeature, NavigationErrorHandlerFeature, PreloadingFeature, RouterConfigurationFeature, RouterFeature, RouterFeatures, RouterHashLocationFeature, ViewTransitionInfo, ViewTransitionsFeature, ViewTransitionsFeatureOptions };