1
我正在使用$q
服務來等待承諾返回,但定義承諾的服務正在按照指令$q
服務。所以當$q
服務被調用時,承諾是undefined
。
在指令(被先打)
this.qService.all([this.summaryVm.positionsServicePromise]).then((result: Array<any>) => {...}
在Service(被擊中秒)
this.summaryVm = vm;
var positionServicePromise = this.$http.get(this.url);
this.summaryVm.positionsServicePromise = positionServicePromise;
我需要$http.get()
在PositionsService
被調用,似乎如果承諾爲undefined
,則$q
服務將忽略全部.then
。有沒有辦法臨時定義所有.then
等待承諾更新的承諾?
你可以分享更多的代碼來獲取上下文嗎? – tanmay