Repository navigation
Description
Describe the problem that you experienced
This error is printed in the console and can be more clear.
See the assertStandalone function:
https://github.com/angular/angular/blob/main/packages/router/src/utils/config.ts
The error told me to "Invalid configuration of route 'XYZ' The component must be standalone"
However, this would NOT fix my problem. The issue was not that my component MUST be standalone. Rather, I was using it in a non-standalone situation.
Enter the URL of the topic with the problem
Describe what you were looking for in the documentation
Describe in more detail 'standalone'. Perhaps say "This component is trying to be loaded as standalone but it is not marked as standalone. Did you mean to include it in a module?"
Describe the actions that led you to experience the problem
My issue is that I incorrectly used loadComponent instead of loadChildren which is an obvious mistake. However I likely did this because the two properties are named similar and did not present any type-safety problems.
Describe what you want to experience that would fix the problem
Better error messaging. Type Safety would be best.
Add a screenshot if that helps illustrate the problem
No response
If this problem caused an exception or error, please paste it here
{
path: 'protected',
canLoad: [OktaAuthGuard],
canActivate: [OktaAuthGuard],
loadComponent: () => import('./protected/protected.module').then((m) => m.ProtectedModule),
},
### If the problem is browser-specific, please specify the device, OS, browser, and version
_No response_
### Provide any additional information here in as much as detail as you can
_No response_
Activity
atscott commentedon Feb 3, 2023
The reason it's not a type error is that modules and components are both classes. We can't distinguish between the two in the type system. That said, the runtime check can likely be improved.
IvanNavarroCode commentedon Feb 19, 2023
@atscott maybe the message could be improved like this? Any suggestion is appreciated.
I could submit a PR if this looks OK.
atscott commentedon Feb 19, 2023
@Ivnosing I was thinking that instead you can look at the instance type of the item and see if it's a module to provide a different message that doesn't say "maybe" since now we're pretty sure we know what was meant. That is, something like
JeanMeche commentedon Apr 11, 2023
@atscott I think this issue can be closed now !
angular-automatic-lock-bot commentedon May 12, 2023
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.