Is it possible to load external modules at runtime in angular 4? -


background

the web application in question consists of main part (sort of framework) standard users , number of modules, of standard, number of them user-specific.

simply described main standard program standard things communication , session logic, loads user-specific ui (layout, graphics) modules, in turn make use of set of modules (like buttons, tables etc.) standard users. user-specific modules have common interface , function, differ in layout , number of standard modules used (one ten, different ones). number of user-specific modules varies user (again, 1 ten).

we have solution implemented combination of libraries (jquery, require.js , knockout.js being main ones), , struggle come similar functionality angular. answer saying not possible , why valid (if undesirable) one.

the problem

i'd rather user-specific modules not part of project number of reasons:

  • standard modules maintained different team user-specific ones , have highly independent development cycles.
  • there great many users , every user has specific modules, makes impractical manage both standard , user-specific modules within 1 project.
  • standard , user-specific modules upgraded independently of 1 another.
  • the user-specific modules @ least partly generated or scaffolded.

desired solution

the main program loads 2 sets of data - list of available user-specific modules, configuration defines module should used @ placeholder element.

the user-specific modules loaded (via factory, router, solution goes), , used usual modules far possible, sharing common interface. importantly, can make use of other standard modules standard project.

this sounds dependency injection issue. why not declare modules ahead , play modules injecting. meaning, can set mock/empty modules if don't want/need them, , replace them real modules need them. that's beauty of dependency injection.


Comments