![](/img/trans.png)
[英]In AngularJS ui-router, state changed, url changed but template url not
[英]Get state given url with ui-router AngularJS 1.x
如何将当前网址转换为相应的状态? 结果状态将用于通过$ state.go进行状态转换。
示例: http:// localhost / auth / enterprise /
注册路线:
{
"stateName": "auth.context",
"url": ":context"
}
结果 :auth / enterprise / => auth.context
示例: http:// localhost / auth / enterprise / esdrubal
注册路线:
{
"stateName": "auth.context",
"url": ":context/:username"
}
结果 :auth / enterprise / esdrubal => auth.context
解决方案 :
您可以使用$ stateProvider上的.decorator挂钩公开内部状态实现。 您可以装饰状态生成器的任何属性; 我任意选择了“父母”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.