在Angular localize-router中,如果路径包含多个斜杠/更改语言中断 [英] In Angular localize-router if path contains multiple slashes / change language breaks
本文介绍了在Angular localize-router中,如果路径包含多个斜杠/更改语言中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Angular 7并本地化路由器v2.0RC.
如果我的路线路径是这样,我将面临一个问题:
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
}
]
}]
当我使用LocalizeRouterService
中的changeLanguage
方法时,浏览器中的URL会更改,但parentX
之后的所有斜杠都将进行url编码(转义)并由%2F
替换,这将导致不匹配列表中的任何路由.
为什么会这样?
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 ?
推荐答案
我发现的解决方案是这样做:
The solution I found is to do this:
[{
path: 'parentX',
children: [
{
path: 'y',
children: [
{
path: 'z',
component: AnyComponent
}
]
}
]
}]
这篇关于在Angular localize-router中,如果路径包含多个斜杠/更改语言中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文