Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda