gpt4 book ai didi

javascript - 使用 ui-router AngularJS 1.x 获取给定 url 的状态

转载 作者:行者123 更新时间:2023-11-28 06:44:17 26 4
gpt4 key购买 nike

如何将当前URL转换为相应的状态?结果状态将用于使用 $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

最佳答案

解决方案:

You can expose the internal state implementation by using the .decorator hook on $stateProvider. You can decorate any property of the state builder; I chose 'parent' arbitrarily.

https://stackoverflow.com/a/30926025/5485700

关于javascript - 使用 ui-router AngularJS 1.x 获取给定 url 的状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33521286/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com