Javascript '/';在url中替换为%252F,同时在url中重新加载$state
我使用angularjs中的ui路由器进行路由。我有类似的urlJavascript '/';在url中替换为%252F,同时在url中重新加载$state,javascript,angularjs,angular-ui-router,url-routing,Javascript,Angularjs,Angular Ui Router,Url Routing,我使用angularjs中的ui路由器进行路由。我有类似的url www.example.com/*variable 其中变量的形式为word1/word2 因此url变成www.example.com/word1/word2 但当我申请时 $state.reload(); or $state.go($state.current,{},reload:true); 正斜杠被替换为%252,url变为 www.example.com/word1%252Fword2 为什么会发生这种情况,解决
www.example.com/*variable
其中变量的形式为word1/word2
因此url变成www.example.com/word1/word2
但当我申请时
$state.reload(); or
$state.go($state.current,{},reload:true);
正斜杠被替换为%252
,url变为
www.example.com/word1%252Fword2
为什么会发生这种情况,解决办法是什么 您是否尝试将位置设置为false
$state.go($state.current,{},{reload:true,location:false})代码>
因为您指定的是URL参数,所以它们可能是以URL编码格式重新编写的。用户界面路由器文件状态
位置布尔值或“替换”(默认为true),如果为true,将更新位置栏中的url,如果为false,则不会更新。如果字符串“replace”,将更新url并替换最后的历史记录
嘿,你能提供代码吗?你看到了吗?我尝试了这个解决方案,但正则表达式模式不起作用。我正在使用{variable:.*}
。如何在$URLMacherFactoryProvider中工作?