(
injector: EnvironmentInjector,
routes: Route[],
route: Route,
rawSegment: UrlSegmentGroup,
segments: UrlSegment[],
outlet: string,
allowRedirects: boolean,
parentRoute: ActivatedRouteSnapshot,
)
| 293 | } |
| 294 | |
| 295 | async processSegmentAgainstRoute( |
| 296 | injector: EnvironmentInjector, |
| 297 | routes: Route[], |
| 298 | route: Route, |
| 299 | rawSegment: UrlSegmentGroup, |
| 300 | segments: UrlSegment[], |
| 301 | outlet: string, |
| 302 | allowRedirects: boolean, |
| 303 | parentRoute: ActivatedRouteSnapshot, |
| 304 | ): Promise<TreeNode<ActivatedRouteSnapshot> | NoLeftoversInUrl | NoMatch | AbsoluteRedirect> { |
| 305 | // We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to |
| 306 | // a config like |
| 307 | // * `{path: '', children: [{path: 'b', outlet: 'b'}]}` |
| 308 | // or even |
| 309 | // * `{path: '', outlet: 'a', children: [{path: 'b', outlet: 'b'}]` |
| 310 | // |
| 311 | // The exception here is when the segment outlet is for the primary outlet. This would |
| 312 | // result in a match inside the named outlet because all children there are written as primary |
| 313 | // outlets. So we need to prevent child named outlet matches in a url like `/b` in a config like |
| 314 | // * `{path: '', outlet: 'x' children: [{path: 'b'}]}` |
| 315 | // This should only match if the url is `/(x:b)`. |
| 316 | if ( |
| 317 | getOutlet(route) !== outlet && |
| 318 | (outlet === PRIMARY_OUTLET || |
| 319 | !emptyPathMatch(rawSegment, segments, route) || |
| 320 | // the route has no children to pierce into. |
| 321 | (!route.children?.length && !route.loadChildren) || |
| 322 | // the URL segment group has no segments or children to pierce with. |
| 323 | (segments.length === 0 && !rawSegment.hasChildren())) |
| 324 | ) { |
| 325 | return new NoMatch(); |
| 326 | } |
| 327 | |
| 328 | if (route.redirectTo === undefined) { |
| 329 | return this.matchSegmentAgainstRoute( |
| 330 | injector, |
| 331 | rawSegment, |
| 332 | route, |
| 333 | segments, |
| 334 | outlet, |
| 335 | parentRoute, |
| 336 | ); |
| 337 | } |
| 338 | |
| 339 | if (this.allowRedirects && allowRedirects) { |
| 340 | return this.expandSegmentAgainstRouteUsingRedirect( |
| 341 | injector, |
| 342 | rawSegment, |
| 343 | routes, |
| 344 | route, |
| 345 | segments, |
| 346 | outlet, |
| 347 | parentRoute, |
| 348 | ); |
| 349 | } |
| 350 | |
| 351 | return new NoMatch(); |
| 352 | } |
no test coverage detected