dynamically loading children router

91 views
Skip to first unread message

Long Field

unread,
Jan 10, 2019, 12:24:08 AM1/10/19
to Angular and AngularJS discussion
Hi All,
Anyone has example to Dynamically load children router for angular 6+ version.

I have my one works under angular 5, failed to update to angular 6 and failed to re-do it. 
Thanks! 

Sander Elias

unread,
Jan 14, 2019, 4:42:02 AM1/14/19
to Angular and AngularJS discussion
Hi Long,

Can you elaborate a bit on your question? So you have a solution under Angular 5 that doesn't work on 6?
Sounds like a regression that needs to be fixed.

Regards
Sander

Long Field

unread,
Jan 14, 2019, 10:55:44 PM1/14/19
to Angular and AngularJS discussion

Ok, after read this : https://blog.angularindepth.com/the-three-pillars-of-angular-routing-angular-router-series-introduction-fb34e4e8758e

realised in there is  "a tree of route stats" structure  which my old does not, i will try to re-do as this  and to see what will happen 

Long Field

unread,
Jan 21, 2019, 12:43:24 AM1/21/19
to Angular and AngularJS discussion
Hi Sander

Basically I have problem to do lazy load router in nested way.

Please check this:


There is nested <router-outlet /> , means one <router-outlet /> inside another. I believe this programmer has done right way, but sample does not working, can only render to the outside <router-outlet />, not the inside <router-outlet />.

Sander, do you think he/she's done right way or there is some error in angular/router framework itself?  

I have go through whole internet won't find work one, Could you point me to right code sample if there is one?

Thanks! 


On Monday, January 14, 2019 at 8:42:02 PM UTC+11, Sander Elias wrote:

Long Field

unread,
Jan 21, 2019, 1:02:41 AM1/21/19
to Angular and AngularJS discussion

Long Field

unread,
Jan 21, 2019, 1:14:29 AM1/21/19
to Angular and AngularJS discussion

Sander Elias

unread,
Jan 21, 2019, 1:20:28 AM1/21/19
to Angular and AngularJS discussion
Hi Long,

I did not check out your examples/links. However, I'm 100% sure nested lazy routes work. I'm using those on a day to day base.
But yes, there is a consistency issue between eager and lazy loaded routes. Personally, I think lazy routes are easier to work with and make more sense. 
If this is an issue in your project, Shai wrote a blog on how to unify those.

Regards
Sander

Sander Elias

unread,
Jan 21, 2019, 1:21:59 AM1/21/19
to Angular and AngularJS discussion
Oh, you were referring to Shai's work.

Yes, he is right, and it should work. I'll contact him so he can make his samples work.

Regards
Sander

Sander Elias

unread,
Jan 21, 2019, 1:30:56 AM1/21/19
to Angular and AngularJS discussion
Just double-checked his sample, and that works.
Took a quick peek at your, an I see your issue. However, I lack the time to dig in deeply. 

Regards
Sander

Long Field

unread,
Jan 22, 2019, 6:30:53 AM1/22/19
to Angular and AngularJS discussion
Sander,   if you see my issue, and you see Shai's issue because they are exactly the same.  But I don't believe it is Shai's issue, I believe that is framework's issue.

As my project (that I cannot show public) has the same issue.

Sander Elias

unread,
Jan 22, 2019, 11:54:47 PM1/22/19
to Angular and AngularJS discussion
Hi Long,

If you believe there is an actual error in Angular, you should raise an issue on GitHub. But try to make your example easier to follow along. Make a good description on how to reproduce it.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages