Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NG2 Cli module discovery and loading

Im starting to develop a front end for a completely modular backend (a vertx verticles docker cluster).

The main idea/problem is to have a base ng2 application that defines a dashboard, sidemenu, other base components, and connects to the backend discovering which modules are enabled, via some kind of list of manifests containing the the path for the required JS files/bundles, the modules should be completely independent, something that you would be able to download from github and place in a folder.

So far the closest thing I've found was this question, Angular2: Loading modules dynamically from a given folder, that show how to load modules in runtime, but I hanven't found a way to develop and build the bundles independently.

Is this even possible? Can you guys point me in the right direction? Have I missed any example of this?

like image 217
Eduardo Oliveira Avatar asked Nov 08 '22 02:11

Eduardo Oliveira


1 Answers

If you are going for Angular CLI for this instead of rolling your own build, all the routes have to be defined up-front.

What you can do though is set all modules are lazy loaded router modules (using load-children, and then have router guards for loading them depending on what dashboard says for example.

like image 85
Meligy Avatar answered Nov 15 '22 07:11

Meligy