angular $http同步请求
$scope.queryDayWork= function () {
return $q(function (resolve,reject) {
var url = ‘SalaryVerification/Standard/InProcessUnitSalaryVerificationInfos’;
$http({
url: url,
method: ‘GET’,
params: $scope.search
}).success(function (data) {
resolve(data.data);
}).error(function (data, status) {
reject();
});
});
};
$scope.queryHireDatas= function () {
return $q(function (resolve,reject) {
var url = ‘SalaryVerification/Standard/queryHireDatas’;
$http({
url: url,
method: ‘GET’,
params: $scope.search
}).success(function (data) {
resolve(data.data);
}).error(function (data, status) {
reject();
});
});
};
q
.
a
l
l
(
[
q.all([
q.all([scope.queryDayWork(), $scope.queryHireDatas()]).then(function (data) {
//data存储的时校验返回的信息
data.forEach(function (item) {
if(item){
…
}
});
});