@angular/router 7.2.8 → 7.2.12
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/bundles/router-testing.umd.js +1 -1
- package/bundles/router-testing.umd.js.map +1 -1
- package/bundles/router-testing.umd.min.js +1 -1
- package/bundles/router-testing.umd.min.js.map +1 -1
- package/bundles/router-upgrade.umd.js +1 -1
- package/bundles/router-upgrade.umd.min.js +1 -1
- package/bundles/router-upgrade.umd.min.js.map +1 -1
- package/bundles/router.umd.js +57 -48
- package/bundles/router.umd.js.map +1 -1
- package/bundles/router.umd.min.js +3 -3
- package/bundles/router.umd.min.js.map +1 -1
- package/esm2015/src/config.js +316 -17
- package/esm2015/src/router.js +87 -76
- package/esm2015/src/router_module.js +18 -35
- package/esm2015/src/version.js +1 -1
- package/esm5/src/config.js +1 -1
- package/esm5/src/router.js +56 -47
- package/esm5/src/router_module.js +1 -1
- package/esm5/src/version.js +1 -1
- package/fesm2015/router.js +56 -54
- package/fesm2015/router.js.map +1 -1
- package/fesm2015/testing.js +1 -1
- package/fesm2015/upgrade.js +1 -1
- package/fesm5/router.js +57 -48
- package/fesm5/router.js.map +1 -1
- package/fesm5/testing.js +1 -1
- package/fesm5/upgrade.js +1 -1
- package/package.json +4 -4
- package/router.metadata.json +1 -1
- package/src/config.d.ts +259 -206
- package/src/router.d.ts +45 -36
- package/src/router_module.d.ts +25 -42
- package/testing.d.ts +1 -1
- package/upgrade.d.ts +1 -1
package/src/config.d.ts
CHANGED
|
@@ -10,53 +10,132 @@ import { Observable } from 'rxjs';
|
|
|
10
10
|
import { ActivatedRouteSnapshot } from './router_state';
|
|
11
11
|
import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
12
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
|
-
* - `pathParamsOrQueryParamsChange` - Same as `pathParamsChange`, but also rerun when any query
|
|
47
|
-
* param changes
|
|
48
|
-
* - `always` - Run guards and resolvers on every navigation.
|
|
49
|
-
* - (from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean - Use a predicate
|
|
50
|
-
* function when none of the pre-configured modes fit the needs of the application. An example
|
|
51
|
-
* might be when you need to ignore updates to a param such as `sortDirection`, but need to
|
|
52
|
-
* reload guards and resolvers when changing the `searchRoot` param.
|
|
53
|
-
* - `children` is an array of child route definitions.
|
|
54
|
-
* - `loadChildren` is a reference to lazy loaded child routes. See `LoadChildren` for more
|
|
55
|
-
* info.
|
|
13
|
+
* Represents a route configuration for the Router service.
|
|
14
|
+
* An array of `Route` objects, used in `Router.config` and for nested route configurations
|
|
15
|
+
* in `Route.children`.
|
|
16
|
+
*
|
|
17
|
+
* @see `Route`
|
|
18
|
+
* @see `Router`
|
|
19
|
+
* @publicApi
|
|
20
|
+
*/
|
|
21
|
+
export declare type Routes = Route[];
|
|
22
|
+
/**
|
|
23
|
+
* Represents the result of matching URLs with a custom matching function.
|
|
24
|
+
*
|
|
25
|
+
* * `consumed` is an array of the consumed URL segments.
|
|
26
|
+
* * `posParams` is a map of positional parameters.
|
|
27
|
+
*
|
|
28
|
+
* @see `UrlMatcher()`
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
31
|
+
export declare type UrlMatchResult = {
|
|
32
|
+
consumed: UrlSegment[];
|
|
33
|
+
posParams?: {
|
|
34
|
+
[name: string]: UrlSegment;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A function for matching a route against URLs. Implement a custom URL matcher
|
|
39
|
+
* for `Route.matcher` when a combination of `path` and `pathMatch`
|
|
40
|
+
* is not expressive enough.
|
|
41
|
+
*
|
|
42
|
+
* @param segments An array of URL segments.
|
|
43
|
+
* @param group A segment group.
|
|
44
|
+
* @param route The route to match against.
|
|
45
|
+
* @returns The match-result,
|
|
56
46
|
*
|
|
57
47
|
* @usageNotes
|
|
48
|
+
*
|
|
49
|
+
* The following matcher matches HTML files.
|
|
50
|
+
*
|
|
51
|
+
* ```
|
|
52
|
+
* export function htmlFiles(url: UrlSegment[]) {
|
|
53
|
+
* return url.length === 1 && url[0].path.endsWith('.html') ? ({consumed: url}) : null;
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* export const routes = [{ matcher: htmlFiles, component: AnyComponent }];
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @publicApi
|
|
60
|
+
*/
|
|
61
|
+
export declare type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult;
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* Represents static data associated with a particular route.
|
|
65
|
+
*
|
|
66
|
+
* @see `Route#data`
|
|
67
|
+
*
|
|
68
|
+
* @publicApi
|
|
69
|
+
*/
|
|
70
|
+
export declare type Data = {
|
|
71
|
+
[name: string]: any;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* Represents the resolved data associated with a particular route.
|
|
76
|
+
*
|
|
77
|
+
* @see `Route#resolve`.
|
|
78
|
+
*
|
|
79
|
+
* @publicApi
|
|
80
|
+
*/
|
|
81
|
+
export declare type ResolveData = {
|
|
82
|
+
[name: string]: any;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* A function that is called to resolve a collection of lazy-loaded routes.
|
|
87
|
+
*
|
|
88
|
+
* @see `Route#loadChildren`.
|
|
89
|
+
* @publicApi
|
|
90
|
+
*/
|
|
91
|
+
export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Promise<Type<any>> | Observable<Type<any>>;
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* A string of the form `path/to/file#exportName` that acts as a URL for a set of routes to load,
|
|
95
|
+
* or a function that returns such a set.
|
|
96
|
+
*
|
|
97
|
+
* @see `Route#loadChildren`.
|
|
98
|
+
* @publicApi
|
|
99
|
+
*/
|
|
100
|
+
export declare type LoadChildren = string | LoadChildrenCallback;
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* How to handle query parameters in a router link.
|
|
104
|
+
* One of:
|
|
105
|
+
* - `merge` : Merge new with current parameters.
|
|
106
|
+
* - `preserve` : Preserve current parameters.
|
|
107
|
+
*
|
|
108
|
+
* @see `RouterLink#queryParamsHandling`.
|
|
109
|
+
* @publicApi
|
|
110
|
+
*/
|
|
111
|
+
export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* A policy for when to run guards and resolvers on a route.
|
|
115
|
+
*
|
|
116
|
+
* @see `Route#runGuardsAndResolvers`
|
|
117
|
+
* @publicApi
|
|
118
|
+
*/
|
|
119
|
+
export declare type RunGuardsAndResolvers = 'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always' | ((from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean);
|
|
120
|
+
/**
|
|
121
|
+
* A configuration object that defines a single route.
|
|
122
|
+
* A set of routes are collected in a `Routes` array to define a `Router` configuration.
|
|
123
|
+
* The router attempts to match segments of a given URL against each route,
|
|
124
|
+
* using the configuration options defined in this object.
|
|
125
|
+
*
|
|
126
|
+
* Supports static, parameterized, redirect, and wildcard routes, as well as
|
|
127
|
+
* custom route data and resolve methods.
|
|
128
|
+
*
|
|
129
|
+
* For detailed usage information, see the [Routing Guide](guide/router).
|
|
130
|
+
*
|
|
131
|
+
* @usageNotes
|
|
132
|
+
*
|
|
58
133
|
* ### Simple Configuration
|
|
59
134
|
*
|
|
135
|
+
* The following route specifies that when navigating to, for example,
|
|
136
|
+
* `/team/11/user/bob`, the router creates the 'Team' component
|
|
137
|
+
* with the 'User' child component in it.
|
|
138
|
+
*
|
|
60
139
|
* ```
|
|
61
140
|
* [{
|
|
62
141
|
* path: 'team/:id',
|
|
@@ -68,11 +147,12 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
68
147
|
* }]
|
|
69
148
|
* ```
|
|
70
149
|
*
|
|
71
|
-
* When navigating to `/team/11/user/bob`, the router will create the team component with the user
|
|
72
|
-
* component in it.
|
|
73
|
-
*
|
|
74
150
|
* ### Multiple Outlets
|
|
75
151
|
*
|
|
152
|
+
* The following route creates sibling components with multiple outlets.
|
|
153
|
+
* When navigating to `/team/11(aux:chat/jim)`, the router creates the 'Team' component next to
|
|
154
|
+
* the 'Chat' component. The 'Chat' component is placed into the 'aux' outlet.
|
|
155
|
+
*
|
|
76
156
|
* ```
|
|
77
157
|
* [{
|
|
78
158
|
* path: 'team/:id',
|
|
@@ -84,22 +164,27 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
84
164
|
* }]
|
|
85
165
|
* ```
|
|
86
166
|
*
|
|
87
|
-
* When navigating to `/team/11(aux:chat/jim)`, the router will create the team component next to
|
|
88
|
-
* the chat component. The chat component will be placed into the aux outlet.
|
|
89
|
-
*
|
|
90
167
|
* ### Wild Cards
|
|
91
168
|
*
|
|
169
|
+
* The following route uses wild-card notation to specify a component
|
|
170
|
+
* that is always instantiated regardless of where you navigate to.
|
|
171
|
+
*
|
|
92
172
|
* ```
|
|
93
173
|
* [{
|
|
94
174
|
* path: '**',
|
|
95
|
-
* component:
|
|
175
|
+
* component: WildcardComponent
|
|
96
176
|
* }]
|
|
97
177
|
* ```
|
|
98
178
|
*
|
|
99
|
-
* Regardless of where you navigate to, the router will instantiate the sink component.
|
|
100
|
-
*
|
|
101
179
|
* ### Redirects
|
|
102
180
|
*
|
|
181
|
+
* The following route uses the `redirectTo` property to ignore a segment of
|
|
182
|
+
* a given URL when looking for a child path.
|
|
183
|
+
*
|
|
184
|
+
* When navigating to '/team/11/legacy/user/jim', the router changes the URL segment
|
|
185
|
+
* '/team/11/legacy/user/jim' to '/team/11/user/jim', and then instantiates
|
|
186
|
+
* the Team component with the User child component in it.
|
|
187
|
+
*
|
|
103
188
|
* ```
|
|
104
189
|
* [{
|
|
105
190
|
* path: 'team/:id',
|
|
@@ -114,17 +199,17 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
114
199
|
* }]
|
|
115
200
|
* ```
|
|
116
201
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
* If the `redirectTo` value starts with a '/', then it is an absolute redirect. E.g., if in the
|
|
122
|
-
* example above we change the `redirectTo` to `/user/:name`, the result url will be '/user/jim'.
|
|
123
|
-
*
|
|
202
|
+
* The redirect path can be relative, as shown in this example, or absolute.
|
|
203
|
+
* If we change the `redirectTo` value in the example to the absolute URL segment '/user/:name',
|
|
204
|
+
* the result URL is also absolute, '/user/jim'.
|
|
205
|
+
|
|
124
206
|
* ### Empty Path
|
|
125
207
|
*
|
|
126
208
|
* Empty-path route configurations can be used to instantiate components that do not 'consume'
|
|
127
|
-
* any
|
|
209
|
+
* any URL segments.
|
|
210
|
+
*
|
|
211
|
+
* In the following configuration, when navigating to
|
|
212
|
+
* `/team/11`, the router instantiates the 'AllUsers' component.
|
|
128
213
|
*
|
|
129
214
|
* ```
|
|
130
215
|
* [{
|
|
@@ -140,9 +225,11 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
140
225
|
* }]
|
|
141
226
|
* ```
|
|
142
227
|
*
|
|
143
|
-
*
|
|
228
|
+
* Empty-path routes can have children. In the following example, when navigating
|
|
229
|
+
* to `/team/11/user/jim`, the router instantiates the wrapper component with
|
|
230
|
+
* the user component in it.
|
|
144
231
|
*
|
|
145
|
-
*
|
|
232
|
+
* Note that an empty path route inherits its parent's parameters and data.
|
|
146
233
|
*
|
|
147
234
|
* ```
|
|
148
235
|
* [{
|
|
@@ -159,21 +246,11 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
159
246
|
* }]
|
|
160
247
|
* ```
|
|
161
248
|
*
|
|
162
|
-
* When navigating to `/team/11/user/jim`, the router will instantiate the wrapper component with
|
|
163
|
-
* the user component in it.
|
|
164
|
-
*
|
|
165
|
-
* An empty path route inherits its parent's params and data. This is because it cannot have its
|
|
166
|
-
* own params, and, as a result, it often uses its parent's params and data as its own.
|
|
167
|
-
*
|
|
168
249
|
* ### Matching Strategy
|
|
169
250
|
*
|
|
170
|
-
*
|
|
171
|
-
* the
|
|
172
|
-
*
|
|
173
|
-
* We can change the matching strategy to make sure that the path covers the whole unconsumed url,
|
|
174
|
-
* which is akin to `unconsumedUrl === path` or `$` regular expressions.
|
|
175
|
-
*
|
|
176
|
-
* This is particularly important when redirecting empty-path routes.
|
|
251
|
+
* The default path-match strategy is 'prefix', which means that the router
|
|
252
|
+
* checks URL elements from the left to see if the URL matches a specified path.
|
|
253
|
+
* For example, '/team/11/user' matches 'team/:id'.
|
|
177
254
|
*
|
|
178
255
|
* ```
|
|
179
256
|
* [{
|
|
@@ -186,11 +263,14 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
186
263
|
* }]
|
|
187
264
|
* ```
|
|
188
265
|
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
266
|
+
* You can specify the path-match strategy 'full' to make sure that the path
|
|
267
|
+
* covers the whole unconsumed URL. It is important to do this when redirecting
|
|
268
|
+
* empty-path routes. Otherwise, because an empty path is a prefix of any URL,
|
|
269
|
+
* the router would apply the redirect even when navigating to the redirect destination,
|
|
270
|
+
* creating an endless loop.
|
|
191
271
|
*
|
|
192
|
-
*
|
|
193
|
-
* '/'.
|
|
272
|
+
* In the following example, supplying the 'full' `patchMatch` strategy ensures
|
|
273
|
+
* that the router applies the redirect if and only if navigating to '/'.
|
|
194
274
|
*
|
|
195
275
|
* ```
|
|
196
276
|
* [{
|
|
@@ -205,13 +285,15 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
205
285
|
*
|
|
206
286
|
* ### Componentless Routes
|
|
207
287
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
288
|
+
* You can share parameters between sibling components.
|
|
289
|
+
* For example, suppose that two sibling components should go next to each other,
|
|
290
|
+
* and both of them require an ID parameter. You can accomplish this using a route
|
|
291
|
+
* that does not specify a component at the top level.
|
|
212
292
|
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
293
|
+
* In the following example, 'ChildCmp' and 'AuxCmp' are siblings.
|
|
294
|
+
* When navigating to 'parent/10/(a//aux:b)', the route instantiates
|
|
295
|
+
* the main child and aux child components next to each other.
|
|
296
|
+
* For this to work, the application component must have the primary and aux outlets defined.
|
|
215
297
|
*
|
|
216
298
|
* ```
|
|
217
299
|
* [{
|
|
@@ -223,15 +305,13 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
223
305
|
* }]
|
|
224
306
|
* ```
|
|
225
307
|
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
* has to have the primary and aux outlets defined.
|
|
229
|
-
*
|
|
230
|
-
* The router will also merge the `params`, `data`, and `resolve` of the componentless parent into
|
|
231
|
-
* the `params`, `data`, and `resolve` of the children. This is done because there is no component
|
|
232
|
-
* that can inject the activated route of the componentless parent.
|
|
308
|
+
* The router merges the parameters, data, and resolve of the componentless
|
|
309
|
+
* parent into the parameters, data, and resolve of the children.
|
|
233
310
|
*
|
|
234
|
-
* This is especially useful when child components are defined
|
|
311
|
+
* This is especially useful when child components are defined
|
|
312
|
+
* with an empty path string, as in the following example.
|
|
313
|
+
* With this configuration, navigating to '/parent/10' creates
|
|
314
|
+
* the main child and aux components.
|
|
235
315
|
*
|
|
236
316
|
* ```
|
|
237
317
|
* [{
|
|
@@ -243,14 +323,16 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
243
323
|
* }]
|
|
244
324
|
* ```
|
|
245
325
|
*
|
|
246
|
-
* With this configuration in place, navigating to '/parent/10' will create the main child and aux
|
|
247
|
-
* components.
|
|
248
|
-
*
|
|
249
326
|
* ### Lazy Loading
|
|
250
327
|
*
|
|
251
|
-
* Lazy loading speeds up
|
|
252
|
-
*
|
|
253
|
-
*
|
|
328
|
+
* Lazy loading speeds up application load time by splitting the application
|
|
329
|
+
* into multiple bundles and loading them on demand.
|
|
330
|
+
* To use lazy loading, provide the `loadChildren` property instead of the `children` property.
|
|
331
|
+
*
|
|
332
|
+
* Given the following example route, the router uses the registered
|
|
333
|
+
* `NgModuleFactoryLoader` to fetch an NgModule associated with 'team'.
|
|
334
|
+
* It then extracts the set of routes defined in that NgModule,
|
|
335
|
+
* and transparently adds those routes to the main configuration.
|
|
254
336
|
*
|
|
255
337
|
* ```
|
|
256
338
|
* [{
|
|
@@ -260,130 +342,101 @@ import { UrlSegment, UrlSegmentGroup } from './url_tree';
|
|
|
260
342
|
* }]
|
|
261
343
|
* ```
|
|
262
344
|
*
|
|
263
|
-
* The router will use registered NgModuleFactoryLoader to fetch an NgModule associated with 'team'.
|
|
264
|
-
* Then it will extract the set of routes defined in that NgModule, and will transparently add
|
|
265
|
-
* those routes to the main configuration.
|
|
266
|
-
*
|
|
267
|
-
* @publicApi
|
|
268
|
-
*/
|
|
269
|
-
export declare type Routes = Route[];
|
|
270
|
-
/**
|
|
271
|
-
* @description Represents the results of the URL matching.
|
|
272
|
-
*
|
|
273
|
-
* * `consumed` is an array of the consumed URL segments.
|
|
274
|
-
* * `posParams` is a map of positional parameters.
|
|
275
|
-
*
|
|
276
|
-
* @publicApi
|
|
277
|
-
*/
|
|
278
|
-
export declare type UrlMatchResult = {
|
|
279
|
-
consumed: UrlSegment[];
|
|
280
|
-
posParams?: {
|
|
281
|
-
[name: string]: UrlSegment;
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* @description
|
|
286
|
-
*
|
|
287
|
-
* A function matching URLs
|
|
288
|
-
*
|
|
289
|
-
* A custom URL matcher can be provided when a combination of `path` and `pathMatch` isn't
|
|
290
|
-
* expressive enough.
|
|
291
|
-
*
|
|
292
|
-
* For instance, the following matcher matches html files.
|
|
293
|
-
*
|
|
294
|
-
* ```
|
|
295
|
-
* export function htmlFiles(url: UrlSegment[]) {
|
|
296
|
-
* return url.length === 1 && url[0].path.endsWith('.html') ? ({consumed: url}) : null;
|
|
297
|
-
* }
|
|
298
|
-
*
|
|
299
|
-
* export const routes = [{ matcher: htmlFiles, component: AnyComponent }];
|
|
300
|
-
* ```
|
|
301
|
-
*
|
|
302
|
-
* @publicApi
|
|
303
|
-
*/
|
|
304
|
-
export declare type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult;
|
|
305
|
-
/**
|
|
306
|
-
* @description
|
|
307
|
-
*
|
|
308
|
-
* Represents the static data associated with a particular route.
|
|
309
|
-
*
|
|
310
|
-
* See `Routes` for more details.
|
|
311
|
-
*
|
|
312
|
-
* @publicApi
|
|
313
|
-
*/
|
|
314
|
-
export declare type Data = {
|
|
315
|
-
[name: string]: any;
|
|
316
|
-
};
|
|
317
|
-
/**
|
|
318
|
-
* @description
|
|
319
|
-
*
|
|
320
|
-
* Represents the resolved data associated with a particular route.
|
|
321
|
-
*
|
|
322
|
-
* See `Routes` for more details.
|
|
323
|
-
*
|
|
324
|
-
* @publicApi
|
|
325
|
-
*/
|
|
326
|
-
export declare type ResolveData = {
|
|
327
|
-
[name: string]: any;
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* @description
|
|
331
|
-
*
|
|
332
|
-
* The type of `loadChildren`.
|
|
333
|
-
*
|
|
334
|
-
* See `Routes` for more details.
|
|
335
|
-
*
|
|
336
|
-
* @publicApi
|
|
337
|
-
*/
|
|
338
|
-
export declare type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Promise<Type<any>> | Observable<Type<any>>;
|
|
339
|
-
/**
|
|
340
|
-
* @description
|
|
341
|
-
*
|
|
342
|
-
* The type of `loadChildren`.
|
|
343
|
-
*
|
|
344
|
-
* See `Routes` for more details.
|
|
345
|
-
*
|
|
346
|
-
* @publicApi
|
|
347
|
-
*/
|
|
348
|
-
export declare type LoadChildren = string | LoadChildrenCallback;
|
|
349
|
-
/**
|
|
350
|
-
* @description
|
|
351
|
-
*
|
|
352
|
-
* The type of `queryParamsHandling`.
|
|
353
|
-
*
|
|
354
|
-
* See `RouterLink` for more details.
|
|
355
|
-
*
|
|
356
|
-
*/
|
|
357
|
-
export declare type QueryParamsHandling = 'merge' | 'preserve' | '';
|
|
358
|
-
/**
|
|
359
|
-
* @description
|
|
360
|
-
*
|
|
361
|
-
* The type of `runGuardsAndResolvers`.
|
|
362
|
-
*
|
|
363
|
-
* See `Routes` for more details.
|
|
364
|
-
* @publicApi
|
|
365
|
-
*/
|
|
366
|
-
export declare type RunGuardsAndResolvers = 'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always' | ((from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean);
|
|
367
|
-
/**
|
|
368
|
-
* See `Routes` for more details.
|
|
369
|
-
*
|
|
370
345
|
* @publicApi
|
|
371
346
|
*/
|
|
372
347
|
export interface Route {
|
|
348
|
+
/**
|
|
349
|
+
* The path to match against, a URL string that uses router matching notation.
|
|
350
|
+
* Can include wild-card characters (*). [where is that defined?]
|
|
351
|
+
* Default is "/" (the root path).
|
|
352
|
+
*/
|
|
373
353
|
path?: string;
|
|
354
|
+
/**
|
|
355
|
+
* The path-matching strategy, one of 'prefix' or 'full'.
|
|
356
|
+
* Default is 'prefix'.
|
|
357
|
+
*
|
|
358
|
+
* By default, the router checks URL elements from the left to see if the URL
|
|
359
|
+
* matches a given path, and stops when there is a match. For example,
|
|
360
|
+
* '/team/11/user' matches 'team/:id'.
|
|
361
|
+
* The path-match strategy 'full' matches against the entire URL.
|
|
362
|
+
* It is important to do this when redirecting empty-path routes.
|
|
363
|
+
* Otherwise, because an empty path is a prefix of any URL,
|
|
364
|
+
* the router would apply the redirect even when navigating
|
|
365
|
+
* to the redirect destination, creating an endless loop.
|
|
366
|
+
*
|
|
367
|
+
*/
|
|
374
368
|
pathMatch?: string;
|
|
369
|
+
/**
|
|
370
|
+
* A URL-matching function to use as a custom strategy for path matching.
|
|
371
|
+
* If present, supersedes `path` and `pathMatch`.
|
|
372
|
+
*/
|
|
375
373
|
matcher?: UrlMatcher;
|
|
374
|
+
/**
|
|
375
|
+
* The component to instantiate when the path matches.
|
|
376
|
+
* Can be empty if child routes specify components.
|
|
377
|
+
*/
|
|
376
378
|
component?: Type<any>;
|
|
379
|
+
/**
|
|
380
|
+
* A URL to which to redirect when a the path matches.
|
|
381
|
+
* Absolute if the URL begins with a slash (/), otherwise relative to the path URL.
|
|
382
|
+
* When not present, router does not redirect.
|
|
383
|
+
*/
|
|
377
384
|
redirectTo?: string;
|
|
385
|
+
/**
|
|
386
|
+
* Name of a `RouterOutlet` object where the component can be placed
|
|
387
|
+
* when the path matches.
|
|
388
|
+
*/
|
|
378
389
|
outlet?: string;
|
|
390
|
+
/**
|
|
391
|
+
* An array of dependency-injection tokens used to look up `CanActivate()`
|
|
392
|
+
* handlers, in order to determine if the current user is allowed to
|
|
393
|
+
* activate the component. By default, any user can activate.
|
|
394
|
+
*/
|
|
379
395
|
canActivate?: any[];
|
|
396
|
+
/**
|
|
397
|
+
* An array of DI tokens used to look up `CanActivateChild()` handlers,
|
|
398
|
+
* in order to determine if the current user is allowed to activate
|
|
399
|
+
* a child of the component. By default, any user can activate a child.
|
|
400
|
+
*/
|
|
380
401
|
canActivateChild?: any[];
|
|
402
|
+
/**
|
|
403
|
+
* An array of DI tokens used to look up `CanDeactivate()`
|
|
404
|
+
* handlers, in order to determine if the current user is allowed to
|
|
405
|
+
* deactivate the component. By default, any user can deactivate.
|
|
406
|
+
*
|
|
407
|
+
*/
|
|
381
408
|
canDeactivate?: any[];
|
|
409
|
+
/**
|
|
410
|
+
* An array of DI tokens used to look up `CanLoad()`
|
|
411
|
+
* handlers, in order to determine if the current user is allowed to
|
|
412
|
+
* load the component. By default, any user can load.
|
|
413
|
+
*/
|
|
382
414
|
canLoad?: any[];
|
|
415
|
+
/**
|
|
416
|
+
* Additional developer-defined data provided to the component via
|
|
417
|
+
* `ActivatedRoute`. By default, no additional data is passed.
|
|
418
|
+
*/
|
|
383
419
|
data?: Data;
|
|
420
|
+
/**
|
|
421
|
+
* A map of DI tokens used to look up data resolvers. See `Resolve`.
|
|
422
|
+
*/
|
|
384
423
|
resolve?: ResolveData;
|
|
424
|
+
/**
|
|
425
|
+
* An array of child `Route` objects that specifies a nested route
|
|
426
|
+
* configuration.
|
|
427
|
+
*/
|
|
385
428
|
children?: Routes;
|
|
429
|
+
/**
|
|
430
|
+
* A `LoadChildren` object specifying lazy-loaded child routes.
|
|
431
|
+
*/
|
|
386
432
|
loadChildren?: LoadChildren;
|
|
433
|
+
/**
|
|
434
|
+
* Defines when guards and resolvers will be run. One of
|
|
435
|
+
* - `paramsOrQueryParamsChange` : Run when query parameters change.
|
|
436
|
+
* - `always` : Run on every execution.
|
|
437
|
+
* By default, guards and resolvers run only when the matrix
|
|
438
|
+
* parameters of the route change.
|
|
439
|
+
*/
|
|
387
440
|
runGuardsAndResolvers?: RunGuardsAndResolvers;
|
|
388
441
|
}
|
|
389
442
|
export declare class LoadedRouterConfig {
|