【发布时间】:2015-07-08 12:27:05
【问题描述】:
我有一个 url 数组,要求我必须以同步方式发出 http.get 请求。只有第一个url调用成功后,才应该调用第二个
for(var i in urlArray)
{
/*do some operations and get the next url*/
$scope.alpha(newURL);
}
$scope.alpha = function (newURL) {
$http.get(newURL) // these calls should be synchronous
.success(function () {
})
.error(function () {
});
}
我该怎么做?
【问题讨论】:
-
你尝试过使用 $q 吗?
标签: javascript angularjs http get