how to dynamic load an external bundle into main application at run time

9 views
Skip to first unread message

Nd Gui

unread,
Apr 13, 2020, 6:19:25 AM4/13/20
to Angular and AngularJS discussion

Hi All,

I have an application with multiple menu items, each of them is a sub-application with its own routes, module, and many pages/components.
Now, I want to decouple this umbrella application to a base application (main container) with multiple sub-applications by launching the main application first and then launch sub-applications selectively per user's choice. 
I upgrade the application to Angular 8, but it's still hard to re-organize it to workspace-multi projects or main applications with multiple plugins style. 
I decouple the application with Webpack multiple entries, each entry point to one sub-application, launch the main and then lazy load the other sub-application bundles at run time.
I can load the external bundles, and see the sub-application modules and routes, but I can not navigate to the sub-applications. Debug see something wrong at route._loadedConfig always point to somewhere else. If programmatically assign the _loadedConfig to the routes of the lazy-loaded external module at RouteConfigLoadEnd /route event, routers' content looks all correct, but navigation still doesn't work.

Any idea about this problem?

thanks ahead. 
Reply all
Reply to author
Forward
0 new messages