Cannot use pathMatch without redirect or component, etc anymore regression
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
After updating to Angular 14, I cannot run my project anymore because of missing element in my routing.
{ path: 'message', component: MessagePageComponent, children: [
{ path: '', pathMatch: 'full', canActivate: [AutoSelectGuard] },
{ path: 'settings', component: MessageSettingsComponent, canActivate: [GroupSelectGuard], children: [
. . .
])
{ path: 'summary', component: MessageSummaryComponent, canActivate: [GroupSelectGuard],
Where on the second line the [AutoSelectGuard], redirects to any sub page, depending on the last time you visited that sub page.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
core.mjs:6412 ERROR Error: Invalid configuration of route 'infotainment//message/'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 14.0.1
Node: 16.13.0
Package Manager: npm 8.3.0
OS: win32 x64
Anything else?
After adding “redirectTo:‘settings’” to that second line I got following exception:
core.mjs:6412 ERROR Error: Invalid configuration of route ‘infotainment//message/’: redirectTo and canActivate cannot be used together. Redirects happen before activation so canActivate will never be executed.
So Angular knows I’m using an canActivate guard and it’s mutual exclusive too.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Angular route: pathMatch='full', when to NOT use?
With basic research, I understood, '' will match with other routes "always" and so that might create cyclic redirection if pathMatch: 'full' is ......
Read more >Error: Cannot match any routes in Angular 4 - Stack Overflow
pathMatch is used for redirects, which means that if you have a pathMatch property in your route, you should have a redirectTo as...
Read more >The Ultimate Guide to Redirects: URL Redirections Explained
Redirects send users & search engines from one URL to another. Find out how to use each type here.
Read more >Angular 2 Tutorial - 37 - Redirects and pathMatch - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >Redirections in HTTP - MDN Web Docs - Mozilla
URL redirection, also known as URL forwarding, is a technique to give more ... They imply that the original URL should no longer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The configuration was never intended to be allowed. Before v14, Lazy loaded configs we’re not validated but now they are. This change is listed in the v14 breaking changes.
The use case you’re describing is a feature gap in the API, which is a duplicate of https://github.com/angular/angular/issues/13373
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.