Thị*_*hạm 21 browser-history angularjs angular-ui-router
假设我们有这样的逻辑:
$state.go(stateC)我的问题是如何从状态C回到状态A(假设状态A可以是我们在运行时不知道的任何状态,这意味着用户可以从任何其他状态访问状态B)
Phi*_*hil 36
使用location值为"replace"的选项...
$state.go(stateC, null, {
location: 'replace'
})
Run Code Online (Sandbox Code Playgroud)
请参阅https://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#methods_go
location - {boolean = true | string =} - 如果
true要更新位置栏中的url,则false不会.如果是string,则必须是"replace",这将更新url并替换最后的历史记录.
| 归档时间: |
|
| 查看次数: |
8806 次 |
| 最近记录: |