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

165
Visualizações
Angular2 Routing. The requested path contains undefined segment at index 1

I have a issue with routing in Angular 2. I call router.navigate from an action into a datatable. The rare is that sometimes when i click the button that calls this line its works fine and sometimes it doesnt.

this.router.navigate(['edit', id], {relativeTo: this.activatedRoute});

The error that shows the inspector element is:

The requested path contains undefined segment at index 1

Im using Angular2, DataTables, and Webpack

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

0

Probably your id that pass into in navigate is undefined or null.console your id and fix and then pass into in navigate .i had same issue and fixed it.

about 4 years ago · Santiago Trujillo Relatório

0

I faced the same issue. The basic reason was, It wasn't finding the LINK (url) for the the item. i.e.

BEFORE

 {
    e2eId: '1',
    title: 'myTitle',
    link: null,
    icon: 'icon',
    isActive: false,
   }

AFTER

{
    e2eId: '1',
    title: 'myTitle',
    link: '/somelinehere',
    icon: 'icon',
    isActive: false,
   }

This issue may also arise due to Null value of id or something else with null value as well.

about 4 years ago · Santiago Trujillo Relatório

0

I had the same issue. When I inspected the values passed to the navigate function, I found that my url was undefined. Actually, the main problem was that I tried to navigate before the data was ready. You have to check first if your data is ready to be passed. Like waiting for an event or be subscribed to another callback.

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