$http({
url: "php/load.php",
method: "GET",
params: {'userId':userId}
}).success(function(data, status, headers, config) {
$scope.mydata = data;
mydata = data;
}).error(function(data, status, headers, config) {
});
It's puzzling why neither $scope.mydata nor mydata can be accessed outside of the $http scope. While it's expected that $scope.mydata is limited in scope, it's strange that the global variable - mydata remains undefined.