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

后端 未结 2 1675
日久生厌
日久生厌 2021-02-11 18:12

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 wor

相关标签:
2条回答
  • 2021-02-11 18:15

    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.

    0 讨论(0)
  • 2021-02-11 18:19

    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.

    0 讨论(0)
提交回复
热议问题