我有一个函数和几个$ http获取请求.我需要在执行每个$ http请求后调用另一个函数.但它总是在请求完成之前执行该功能.是什么原因?有办法解决吗?
$scope.json=function(){
$scope.loading = true;
$http.get(DataElementUrl).then(function (response) {
if (!response.data == "")
dataElementJson = response.data;
});
$http.get(categoryComboUrl).then(function (response) {
if (!response.data == "")
categoryComboJson = response.data;
});
$http.get(categoryUrl).then(function (response) {
if (!response.data == "")
categoryJson = response.data;
});
check++;
$scope.getJson();
};
Run Code Online (Sandbox Code Playgroud)