Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!