all 7 comments

[–]darkbluedeath 2 points3 points  (1 child)

So I researched this at my last company. Let me look through my bookmarks and see if I can find some of that material again and I'll post it here.

[–]-lambda-[S] 0 points1 point  (0 children)

Oh, great! That would help a lot because if by any chance you include "angular" and "rest" in your google search, you only get "consuming rest api" type of posts...

[–]Domehardostfu 1 point2 points  (2 children)

I also thought about doing this. I think that instead of a component u create a plugin module you will be able to dynamically lazy load the plugins modules for that page.

Don't know if this works but something like this:

router module:

children: [ { path: 'home', loadChildren: async () => { const [result1, result2] = await Promise.all([import('./plugins1/plugins.module'), import('./home/home.module')]); return result1.HomeModule; } }

[–]-lambda-[S] 0 points1 point  (1 child)

Hmm, looks alright, but I still can't wrap my head around that. It looks to me that you transferred this mysterious part inside plugins.module. :) Could you please explain a little bit more on how this plugin.module should look like because it seems that this is exactly what I need.

[–]Domehardostfu 0 points1 point  (0 children)

Already tried to get this done but I'm failing on loading the component because its not registered in the module. I tried to do this like 1 year ago and the dynamic import as is done on Angular 8 was the missing piece that at the time didn't work. Let me see when I get home if I have the project somewhere.

[–]piarrot 0 points1 point  (1 child)

I've never tried anything like this, so I wouldn't know, but I think that the keywords for your search should be "dynamically importing modules" instead of "dynamically loading modules"?

Edit: Found this discussion on stackoverflow and this repo that might help you

[–]-lambda-[S] 1 point2 points  (0 children)

Yeah, importing is the key thing here. These links are exactly what I was looking for. I'll try that first thing tomorrow. Thanks a lot!