-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router: property 'component' of null when child router has no Redirect. #3979
Comments
+1 I also stumbled over this. |
@ericmartinezr asked me to attach my example since it is a bit different: The error happens when clicking the "Page 1" link. |
Amazing writeup, @ericmartinezr. I'll take a look at this tomorrow afternoon. |
Was this solved? I'm having the same issue when using redirect |
Edit. You already did, disregard my comment. |
I'm also having this issue when clicking a router link after navigating to that component from another. |
I'm hitting this error (not with a redirect but with my Back button) in 4.4.0-RC.0. The issue is that I have a conditionally-rendered |
I am hitting this error, even though I have defined a router in router module, for example the main route 'users' shows up but when I want to go to its children, i.e 'users/stats' it throws this error.
|
@xkLander I'm stucking at this too... Is there any solution? |
Guys, if you're having the same error message open a new issue with a reproduction of the case. I opened this one 2 years ago with the first router iirc, so this issue doesn't apply to the latest router. |
For those hitting this issue and landing on this bug, you are most likely missing a |
I have added the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
It took me a while to figure it out this one
TL;DR When you step in a route which has a nested router without a Redirect in it, it will throw this error message
The TL;DR is too confusing, explaining it a little bit more.
Consider the following code
If I step in 'myproject/#/main' it will throw the error above. This error message dissapears if I add a Redirect in the nested router, which will redirect me (obviously) to the specified path. If I step directly in some child router's path it will work with no error.
I didn't know about
Redirect
so I had my own logic to redirect to some pathThe navigation worked but with the error message.
So basically the idea is to advise the user to add a Redirect when is a nested router, or avoid the error message since the nested router can work too as a main component so forcing the component to be redirected it won't be the better solution in every case.
Here's a plnkr, using alpha36, so you can check it out (just uncomment the
Redirect
)Edit
@Ablu has ran into the same issue (see gitter chat) and from his plnkr it seems that the problem is no the abscence of a
Redirect
but that it is not recognizing the specified component. When I dopath:'main/...', component : MainComponent, ...
it doesn't recognizeMainComponent
as the component handling the pathmain/
. TheRedirect
workaround works because it skips directly to some children path, but when we are in themain
children path it failsThe text was updated successfully, but these errors were encountered: