Aje*_*ani 5 javascript url-routing angularjs angular-ui-router
我在 angularjs 中使用 ui-router 进行路由。我有这样的网址
www.example.com/*variable
Run Code Online (Sandbox Code Playgroud)
其中变量的形式为word1/word2
所以网址就变成了www.example.com/word1/word2
但当我申请时
$state.reload(); or
$state.go($state.current,{},reload:true);
Run Code Online (Sandbox Code Playgroud)
正斜杠被替换为%252并且 url 变为
www.example.com/word1%252Fword2
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况以及解决方案是什么?
您是否尝试过将位置设置为 false?
$state.go($state.current,{},{reload:true, location: false});
由于您正在指定 URL 参数,因此它们可能会以 URL 编码格式重写。UI Router 文档状态
location 布尔值或“替换”(默认 true),如果 true 将更新地址栏中的 url,如果 false 则不会。如果字符串“replace”,将更新 url 并替换最后的历史记录。
| 归档时间: |
|
| 查看次数: |
1763 次 |
| 最近记录: |