我对此有点困惑。我在函数中有两个get调用。一旦这个完整的功能,那就是两个get调用完成了,只有这个功能完成了它的工作。我应该如何使用$ q来让它按照我的需要工作?这是我现在有:
function updateBlackList() {
$http.get("http://127.0.0.1:8000/blacklist/entries/vehicle").then(function (res){
console.log(res)
}).catch(function (err) {
console.log(err)
});
})
$http.get("http://127.0.0.1:8000/blacklist/entries/person").then(function (res){
console.log(res)
}).catch(function (err) {
console.log(err)
});
});
return $q.when();
}
这里withint另一个函数我需要等待上述fiunction完成:
BlackListService.updateBlackList().then(function() {
addVersion(server_version).then(function() {
console.log("Blacklist update complete")
})
})
它没有这样做就像我怀疑它做的事。在TW GET请求完成
这很酷,谢谢你!我会记住 – Harry