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

748
Visualizações
Angular 12: navigate and reload page

I have angular application in which I need to reload page after navigation. I have applied this solution but window.location.reload(); does not work on production. So I have added useHash: true in app-routing.module.ts file. But that also giving me problems while applying SSR in application. So I need alternate way for below code:

this.router.navigate(['path/to'])
  .then(() => {
    window.location.reload();
  });

I have tried by applying window.location.href = window.location.href , window.location.href = window.location.protocol + '//' + window.location.host + '/path/to'; instead of window.location.reload(); but it does not reload the page as expected.

Is there any other way to achieve reloading after navigating in angular 12? Please help and guide.

Edit : Why reload: In application, after login of user, notifications are shown in header. That does not show data if page not reloaded.

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

0

You could try to redirect to root and then redirect to your final destination:

this.router.navigate(['/'])
  .then(() => {
    this.router.navigate(['path/to'])
  });
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