You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lazy loaded module in named outlet throws error #12842
Current behavior
Navigating to route with lazy loaded module in named outlet throws error:
Uncaught (in promise): TypeError: Cannot read property 'routes' of undefined
Expected behavior
Navigating to route with lazy loaded module in named outlet without errors.
Minimal reproduction of the problem with instructions
When I have configured my routes with named outlet and want to have lazy loaded module in that outlet.
What is the motivation / use case for changing the behavior?
Using lazy loaded modules in named outlets.
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 ]
This issue also affects updating matrix-params via router.navigate(). E.g.,
{
path: '', component: DummyWrapperComponent, // Wrapped because a component-less route cannot have a named outlet
outlet: 'popup', // Targetting `popup` outlet in wrapper's parent
children: [
{
path: 'state-scratchpad',
// outlet: 'popup', // Can't target non-primary outlet for lazy-loaded component
// params: { tcomp: '', tmake: '' }, // These matrix params can be updated via router.navigate() if targeting
// `primary` outlet without the wrapper; but for `popup` outlet the wrapper is required
loadChildren: 'app/state-scratchpad/state-scratchpad.module#StateScratchpadModule'
}
]
}
Reacted by Joe Liccini, Martin Ockovsky, Trotyl Yu, Juan Manuel, Kristian Tryggestad, Franziskus Karsunke, Kamran Ahmed, Matthieu Chavaillaz, Kalyan A, Alexey Mikitevich and 18 more
Reacted by Martin Ockovsky, Matthieu Chavaillaz, lizbethms, Rafael Toledano Illán, Joe Lemmer, Pierre Saussure, Radu Woinaroski, jvarahuayta, Stu Squared, Bitcollage and 2 more
Reacted by Amaris
Reacted by Fabrizio De Bortoli, Martin Ockovsky, JK, Matthieu Chavaillaz, stevedeighton, Rafael Toledano Illán, Radu Woinaroski, Pierre Saussure, Stu Squared, Bitcollage and 2 more
I know It's been a while since commit 8f2fa0f, but can you @vsavkin remember why you added that "a componentless route cannot have a named outlet set" guard.
Is it because it's just not possible to lazy load in such a way (because maybe router is designed so) or is this something that will eventually be resolved sometime.
Reacted by mrkosima, Simon Dufour, Fabrizio De Bortoli, thekhoi, Such Kamal, Kai Gossel, denu5, David Camdzic, Roman Gromov, Joe Liccini and 7 more
Why should this be a community problem? This is a Google problem. Point. We applied the patch manually to @angular/router and ... uhm well it just works. This the reason why Angular is the devil. This project is too dependent on Google's death star.
Reacted by Tim Schmidt, Domas Trijonis, William Luc Ritchie and Sven Schöne
Why should this be a community problem? This is a Google problem. Point. We applied the patch manually to @angular/router and ... uhm well it just works. This the reason why Angular is the devil. This project is too dependent on Google's death star.
If a change to Angular causes any consumer's tests to fail, then it's a backwards-incompatible change and needs to be reverted, or at the very least only included in a new major release with suitable warnings around it. In this case, Google just happens to be a high-value consumer of the library. The fact that their tests caught an issue before it made it into a release candidate is good for other consumers like us. See discussion on this topic on the PR #38379.
There's a separate argument to be made that it might be helpful to describe the cause of the test failures publicly, so that non-Google contributors could help with the fix, but that discussion is already happening on the PR and it seems like Google does intend to circle back with that information when they've identified the root cause.
@atscott can you please explain why this fix is listed in the change log for 10.1.0 but this issue is still open and I don't think the PR was merged. Is this a mistake?
@atscott can you please explain why this fix is listed in the change log for 10.1.0 but this issue is still open and I don't think the PR was merged. Is this is a mistake?
"router: support lazy loading for empty path named outlets"
Yes, that’s a mistake. The commit was reverted because we found an issue after it went in. I’ve since investigated the failure more and reworked the solution. I plan to merge the change next week and it’ll go into the 11.0.0-next.1 release.
Would you like to send a PR to correct the changelog?
Activity
CalvinDale commentedon Dec 1, 2016
This issue also affects updating matrix-params via
router.navigate(). E.g.,pleerock commentedon Jan 6, 2017
have anyone find a temporary workaround for this issue? (goal is to load component in named outlets lazily).
jamesbirtles commentedon Jan 6, 2017
We have this
Where proxy route component is simply
pleerock commentedon Jan 6, 2017
@UnwrittenFun yeah it works however it brings a side effect - extra level in the component tree which can bring some problems in some use cases
RatkoR commentedon Jan 22, 2017
I know It's been a while since commit 8f2fa0f, but can you @vsavkin remember why you added that "a componentless route cannot have a named outlet set" guard.
Is it because it's just not possible to lazy load in such a way (because maybe router is designed so) or is this something that will eventually be resolved sometime.
Gromov-Roman commentedon Mar 21, 2017
@UnwrittenFun not work for me on angular 4 rc.5. Have any idea?
kenese commentedon Mar 26, 2017
Hi there, I am also interested to know if we will be able to lazy load secondary routes in the future
martzmakes commentedon Apr 4, 2017
@vsavkin @jeffbcross We ran into this in your ng-conf session
aniruddhadas9 commentedon Apr 13, 2017
still facing the same issue.
http://stackoverflow.com/questions/40769797/angular2-invalid-route-configuration-of-route-outlate-name-a-componentless-ro?noredirect=1#comment73859966_40769797
63 remaining items
destus90 commentedon Aug 20, 2020
The happiness was very close.
lincolnthree commentedon Aug 29, 2020
Omg a fix!!! Yessss! I'll be able to delete soooooo much portal code. Please don't let this PR die! It needs tenderness and nourishment!
fix(router): support lazy loading for empty path named outlets (angul…
cherryland commentedon Sep 1, 2020
Why should this be a community problem? This is a Google problem. Point. We applied the patch manually to @angular/router and ... uhm well it just works. This the reason why Angular is the devil. This project is too dependent on Google's death star.
delego-wlritchi commentedon Sep 1, 2020
If a change to Angular causes any consumer's tests to fail, then it's a backwards-incompatible change and needs to be reverted, or at the very least only included in a new major release with suitable warnings around it. In this case, Google just happens to be a high-value consumer of the library. The fact that their tests caught an issue before it made it into a release candidate is good for other consumers like us. See discussion on this topic on the PR #38379.
There's a separate argument to be made that it might be helpful to describe the cause of the test failures publicly, so that non-Google contributors could help with the fix, but that discussion is already happening on the PR and it seems like Google does intend to circle back with that information when they've identified the root cause.
fix(router): support lazy loading for empty path named outlets
acohenOT commentedon Sep 4, 2020
@atscott can you please explain why this fix is listed in the change log for 10.1.0 but this issue is still open and I don't think the PR was merged. Is this a mistake?
https://github.com/angular/angular/blob/master/CHANGELOG.md
"router: support lazy loading for empty path named outlets"
atscott commentedon Sep 5, 2020
Yes, that’s a mistake. The commit was reverted because we found an issue after it went in. I’ve since investigated the failure more and reworked the solution. I plan to merge the change next week and it’ll go into the 11.0.0-next.1 release.
Would you like to send a PR to correct the changelog?
acohenOT commentedon Sep 5, 2020
Yes, will do.
fix(router): support lazy loading for empty path named outlets (angul…
angular-automatic-lock-bot commentedon Oct 9, 2020
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.