Load modules dynamically within pages


I have same complex pages with dynamic content.
I want to load the modules dynamically after initialization.
The modules which have to be used depend on a service call which is performed at the initialization of the page.

Any ideas?


isn’t the lazy loading the correct way for doing this?

I found nothing how I can use an additional router-outlet inside my Ionic page

Can you explain better what you have and what tou wnat to obtain?
Im not sure im getting it

Currently I’m importing evertything and using *ngIf but the page is to big

some content more contenten

<module 3 if necesarry>

So you have a lot of components (pages) called inside the same page?
How many? Because if we are not talking about 100 modules, i think its pretty normal.

Cam you share an example of your code?

I build a small example. I try to use a named router.outlet inside a page which is loaded inside the main router-outlet.

It only works with a named router-outlet at app.component.

    <ion-title>Inner Router</ion-title>

  <a [routerLink]="['',{outlets:{'inner':['inner']}}]">LINK</a>

  <section style="width: 100%; height: 300px; background-color: aqua;">
    <router-outlet name="inner"></router-outlet>