In Angular localize-router if path contains multiple slashes / change language breaks

烈酒焚心 提交于 2020-05-16 03:42:46

问题


I'm using Angular 7 and localize router v2.0RC.
I'm facing an issue if the path of my route is like this:

[{
  path: 'parentX',
  children: [
   {
     path: 'y/z'
     component: AnyComponent
   }
  ]
}]

when I use the changeLanguage method from LocalizeRouterService the URL in browser changes but all slashes after parentX will be url encoded (escaped) and replaced by %2F which causes not to match any route in the list.
Why is this happening ?


回答1:


The solution I found is to do this:

[{
  path: 'parentX',
  children: [
   {
     path: 'y',
     children: [
       {
        path: 'z',
        component: AnyComponent
       }
     ]
   }
  ]
}]


来源:https://stackoverflow.com/questions/55696188/in-angular-localize-router-if-path-contains-multiple-slashes-change-language-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!