Angular : Lazy load multiple Modules with the same route

I have an app where i want to lazy load two modules in the same moment with the same route path.

My routing module would look like this :

  {
    path: 'mypath',
    loadChildren: () => HomeModule,
    canLoad: [HomeGuard]
  },

   {
     path: 'mypath',
     loadChildren: () => AdvisorModule,
     canLoad: [AdvisorGuard]
   },

but this lead to load only the first one

i cant’ find anyway to do it like this for example :

  {
    path: 'mypath',
    loadChildren: () => HomeModule, advisor module // ??
    canLoad: [// ??]
  },

I don’t want also to import one of them in the other , as like this , only one module would be lazy loaded and the other automatically

How may it do it ??

126 thoughts on “Angular : Lazy load multiple Modules with the same route”

Leave a Comment