我正在寻找替换ui-sref中的字符的可能性,尊重目标的URL.
.state('base.product.detail', {
url: 'detail/:productName-:productId/'
Run Code Online (Sandbox Code Playgroud)
URL现在看起来像:
Now:
http://localhost/detail/My%20Product%20Name-123456789/
Should:
http://localhost/detail/My-Product-Name-123456789/
Run Code Online (Sandbox Code Playgroud)
我想摆脱%20(它们也直接在ui-sref =""中生成)并用减号( - )替换它们.
任何想法如何做到这一点?
此致,马库斯
对于访问我们网站的SEO和遗留外部链接,我们需要为弃用的网址提供后备路由.命名出口的事情变得棘手.现在尝试找到正确的设置,以指定重定向到更新的命名插座的路由.
例如:
https://url.com/prod/000( myOutlet:foo)
应重定向到
https://url.com/prod/000(newOutlet:some/foo),
而000当然是动态的
现在一些反映新旧路线的代码:
OLD:
https://url.com/prod/000(myOutlet:foo)
https://url.com/prod/000(myOutlet:bar)
{
path: ':vars',
outlet: 'myOutlet',
component: VarsComponent
}
NEW:
https://url.com/prod/000(newOutlet:some/error)
https://url.com/prod/000(newOutlet:some/empty)
https://url.com/prod/000(newOutlet:some/foo)
https://url.com/prod/000(newOutlet:some/bar)
{
path: 'some',
outlet: 'newOutlet',
component: VarContainerComponent,
children: [
{
path: 'empty',
component: VarEmptyComponent
},
{
path: 'error',
component: VarErrorComponent
},
{
path: ':var', // OLD implementation should point here
component: VarContentComponent
}
]
}
Run Code Online (Sandbox Code Playgroud)
如何指定OLD实现重定向到新路径:':var'route?
// fake assumption, redirectTo code not working
// 1. simpler solution, using just a static route (currently …
Run Code Online (Sandbox Code Playgroud)