【发布时间】:2015-07-07 22:18:53
【问题描述】:
从 API 端点引入多个数据时遇到问题。 结果返回 undefined 对于 $q.all 方法中的值
$http.get('url').success(function(data, status, headers, config) {
$scope.data1= data;
})
$http.get('url').success(function(data, status, headers, config) {
$scope.data2= data;
})
$http.get('url').success(function(data, status, headers, config) {
$scope.data3= data;
})
$http.get('url').success(function(data, status, headers, config) {
$scope.data4= data;
})
$q.all([$scope.data1, $scope.data2, $scope.data3, $scope.data4]).then(function(values) {
$scope.data= values;
});
【问题讨论】: