我尝试将 $http.get 中的数据分配给控制器中的变量。
$http.get(URL).success(function (data) {
$scope.results = data;
console.log('results in $http.get :'+ $scope.results);
});
console.log('results after http.get'+ $scope.results);
第一个控制台日志从 get 打印数据。在 $http.get(url).success $scope.results 打印为未定义之后。