Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

341
Visualizações
Angular 12 : router-outlet is not rendering the component after upgrade to dymamic import of router module

I have changed my router import from old way of importing

loadChildren: './lazy/lazy.module#LazyModule

I have used dynamic import to load the router module.

loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule)

Now, my is not rendering the components but at the same time header and footer, component are loading fine since it is not loaded from the router-outlet.

app.component.html

<header-component>.  //rendering fine
<router-outlet></router-outlet>. // I am seeing it gets routed in the address bar, but the component is not getting rendering.
<footer-component> //rendering fine 

I don't get any error on the console or vscode for the above issue. How do I debug this issue while the components are blank though it is routed correctly also I am getting an API response for this component in the network tab the API response is not get rendered on the screen as HTML.

This issue happened to me while I am upgrading from Angular 11 to the 12 version.

My detailed code structure is pretty same like this document https://remotestack.io/angular-lazy-load-modules-with-dynamic-module-imports-example/

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

@JSBeginner please share your LazyModule code, and it seems you need to specify how you configured routes in the LazyModule module

for example

const routes: Routes = [
  {
    path: '',
    component: LazyComponent],
  },
];

and add this line of code on imports of lazyModule

RouterModule.forChild(routes),
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda