(
injector: EnvironmentInjector,
routes: Route[],
route: Route,
rawSegment: UrlSegmentGroup,
segments: UrlSegment[],
outlet: string,
allowRedirects: boolean,
parentRoute: ActivatedRouteSnapshot,
)
| 268 | } |
| 269 | |
| 270 | async processSegmentAgainstRoute( |
| 271 | injector: EnvironmentInjector, |
| 272 | routes: Route[], |
| 273 | route: Route, |
| 274 | rawSegment: UrlSegmentGroup, |
| 275 | segments: UrlSegment[], |
| 276 | outlet: string, |
| 277 | allowRedirects: boolean, |
| 278 | parentRoute: ActivatedRouteSnapshot, |
| 279 | ): Promise<TreeNode<ActivatedRouteSnapshot> | NoLeftoversInUrl> { |
| 280 | // We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to |
| 281 | // a config like |
| 282 | // * `{path: '', children: [{path: 'b', outlet: 'b'}]}` |
| 283 | // or even |
| 284 | // * `{path: '', outlet: 'a', children: [{path: 'b', outlet: 'b'}]` |
| 285 | // |
| 286 | // The exception here is when the segment outlet is for the primary outlet. This would |
| 287 | // result in a match inside the named outlet because all children there are written as primary |
| 288 | // outlets. So we need to prevent child named outlet matches in a url like `/b` in a config like |
| 289 | // * `{path: '', outlet: 'x' children: [{path: 'b'}]}` |
| 290 | // This should only match if the url is `/(x:b)`. |
| 291 | if ( |
| 292 | getOutlet(route) !== outlet && |
| 293 | (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route)) |
| 294 | ) { |
| 295 | throw new NoMatch(rawSegment); |
| 296 | } |
| 297 | |
| 298 | if (route.redirectTo === undefined) { |
| 299 | return this.matchSegmentAgainstRoute( |
| 300 | injector, |
| 301 | rawSegment, |
| 302 | route, |
| 303 | segments, |
| 304 | outlet, |
| 305 | parentRoute, |
| 306 | ); |
| 307 | } |
| 308 | |
| 309 | if (this.allowRedirects && allowRedirects) { |
| 310 | return this.expandSegmentAgainstRouteUsingRedirect( |
| 311 | injector, |
| 312 | rawSegment, |
| 313 | routes, |
| 314 | route, |
| 315 | segments, |
| 316 | outlet, |
| 317 | parentRoute, |
| 318 | ); |
| 319 | } |
| 320 | |
| 321 | throw new NoMatch(rawSegment); |
| 322 | } |
| 323 | |
| 324 | private async expandSegmentAgainstRouteUsingRedirect( |
| 325 | injector: EnvironmentInjector, |
no test coverage detected