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

630
Visualizações
exclude specific path from routing in angular 2+

My angular route config is as below:

export const routes: Routes = [
  { path: 'mgmt', ... },
  { path: 'about', ... },
  { path: '**', component: PageNotFoundCmp }
];

But now on a page, there's a link (<a href="/help/en/index.html" target="_blank">) to help pages, which are static resources hosted on the same server. With the above route config, apparently it will be matched to others ** - page not found.

Let's say we cannot host help resources in another domain, is there any way to exclude /help/** path from angular routing? or do you think this is a valid feature request for angular to support?

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

0

As mentioned here angular 2 exclude url in routing the only solution seems to set useHash: true in your RouterModule config:

@NgModule({
  imports: [
    RouterModule.forRoot(
      [
        {
          path: 'login',
          loadChildren: './login/login.module#LoginModule'
        },
        {
          path: '**',
          redirectTo: ''
        },
      ],
      {
        useHash: true,
        onSameUrlNavigation: 'reload'
      }
    )
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }
about 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