【发布时间】:2017-11-24 22:58:13
【问题描述】:
我在咖啡脚本中有 2 个状态...
stateProvider.state 'test',
...
resolve:
user: (LongRunning)->
LongRunning.authenticate().then ->
console.log("We are authenticated!")
stateProvider.state 'test.child',
...
resolve:
other: (AfterAuth)->
AfterAuth.soSomethingWithAuth().then ->
console.log("We are done!")
当然这不起作用,因为子解析是在父的身份验证方法被解析之前启动的。这意味着第二个函数不会被验证并导致整个状态失败。
现在它不一定是状态路径的一部分,但它需要在调用解析函数时完全完成。
在调用子方法之前,如何确保父函数完全解析?
糟糕的 (?) 解决方案
我能想到的一个答案是使用手动引导过程。但是,这很乏味,因为我需要重新连接所有服务。无论如何我可以在 Angular 中做到这一点吗?
【问题讨论】:
标签: angularjs coffeescript angular-ui-router angular-ui