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

134
Visualizações
Routing in angular without hash change but pushing it in the browser history stack

I have an Angular application consisting of the following routes:

const routes: Routes = [
  { path: '', component: IntroComponent },
  { path: 'personal-data', component: PersonalDataComponent },
  { path: 'questionnaire/:id', component: QuestionnaireComponent},
  { path: 'result', component: ResultComponent},
  { path: 'result/:id', component: ResultComponent}
]

The user starts in the IntroComponent, then goes to the PersonalDataComponent and then to 8 pages of QuestionnaireComponent which updates by id (for example /questionnaire/3), before ending up in the ResultComponent. This all happens by user clicks on buttons.

I would like when the route updates, the user does not see that in the url, so the url stays https://example.com but when the user presses the 'back' button in the browser, it does go back to the previous route.

I tried solving it using:

this.router.navigateByUrl(url, { skipLocationChange: true});

But that does not stack it in the browser history. Any ideas?

about 4 years ago · Juan Pablo Isaza
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