-
Notifications
You must be signed in to change notification settings - Fork 27k
Labels
Milestone
Description
Which @angular/* package(s) are relevant/related to the feature request?
No response
Description
Problem
Angular Router currently supports ** only as a catch-all at the end of a route. It lacks support for multi-segment wildcards between fixed segments—e.g., /foo/**/bar should match /foo/a/bar, /foo/a/b/c/bar, but not /foo/bar.
The only workaround today is a custom UrlMatcher, which introduces unnecessary complexity, boilerplate, and testing burden for a common pattern.
Proposal
Component Access
Intermediate segments could be exposed via ActivatedRoute, e.g.:
const segments = route.snapshot.paramMap.get('wildcardSegments');Allow ** to be used between segments in the path property:
{ path: 'foo/**/bar', component: MyComponent }Matching rules:
- Must start with
foo, end withbar - Must include one or more intermediate segments
Examples:
- ✅
/foo/a/bar,/foo/a/b/c/bar - ❌
/foo/bar,/foo/a/b/baz
Benefits
- Declarative, readable routing for hierarchical paths
- Avoids verbose
UrlMatcherimplementations - Improves DX, reduces boilerplate, aids tooling and static analysis
Related:
JelleBruisten, ng-multivers, amihaiemil, imaksp and nifiroe-oz