Angular2 Routing. The requested path contains undefined segment at index 1 Angular2 Routing. The requested path contains undefined segment at index 1 angular angular

Angular2 Routing. The requested path contains undefined segment at index 1


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.


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.


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.