Router with regular expression
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[x] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
I understand that is highly recommended to not use this tool when looking for support, but after spending hours of search and attempts to solve this issue, I don’t have any other option but ask the community here. In angular 2 beta.9-12 there was a way to use a regular expression to determine if some component should be used:
{ regex: '[a-z]+.[0-9]+',
serializer: (params) => `{params.a}.params.b}`,
component: MyComponent }
This option is not available anymore (“@angular/router”: “3.1.0”), so I’m struggling to redirect some urls do the right component. For instance, I can’t distinguish between the two routes:
{ path: ‘:categoryUrl/:productUrl’ } -> goes do product.component { path: ‘:categoryUrl/:page’ } -> goes to category.component
Expected behavior
Router should provide a way to let us specify regular expressions to define if some route should be activated or not.
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Keep organization of urls, specially keep existing SEO ranking.
Please tell us about your environment:
-
Angular version: 2.0.X
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
-
Node (for AoT issues):
node --version
=
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:12 (2 by maintainers)
Is there any place that I can see how to use this new
matcher
? I read the part in API reference and the link forUrlMatcher
seems broken.Any chance to add gist by @matanshukry to the official documentation? As far as I can see a link to documentation for urlmatcher on the official documentation for router is still broken: broken url.