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

369
Visualizações
How to know if angular router has registered route

I'm migrating a set of Anguar microsites info module federation based MFE architecture.

Not all apps will be migrated at once, so I have this issue to solve:

So far, all cross-microsite links were just regular a tags with href and full page reload was done.

Now, as MFEs are being loaded into the shell one by one, sometimes links will point to valid angular route (if MFE was lazy loaded using module federation), but sometimes not.

So, sometimes link would need to be rendered using routerLink directive and sometimes using href.

Is there a way to tell if a route e.g. apps/admin is valid Angular route at runtime in order to decide whether to use routerLink or href?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I'm not sure what you really want, but you can use router.config and loop over it to check if certain path exists or not

  constructor(private router: Router) {
    console.log(this.router.config);
  }


  routeExists(path: string): boolean {
    return this.router.config.some((route) => route.path === path)
  }
over 4 years ago · Santiago Trujillo 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