運行相同的異步函數多次我有一個異步功能,如:與承諾
$scope.get_device_version = function(){
return $q(function(resolve, reject){
$http.get('/api/get_version')
.then(function(response) {
resolve(response.data.version);
},function(response) {
reject("Lost connection..");
});
});
};
問題1:現在我想運行的功能10倍排一個順序,我該怎麼辦?
問題2:現在我想運行這個函數,直到我從http請求得到想要的答案,我該怎麼辦?
請添加說明。僅有代碼的答案很少有幫助。 –