Here is something similar to what I have:
$scope.fetchData = function(path, save_to) {
$http({method: 'GET', url: 'http://localhost:8001/www-root/' + path}).
success(function(data, status, headers, config) {
console.log("Success: " + data);
save_to = data;
}).
error(function(data, status, headers, config) {
alert("Error: " + status);
});
});
When I use the function like this:
$scope.fetchData("get_users.pl", $scope.users);
The function retrieves the data from the server properly, but the $scope.users
variable remains undefined. The question arises - why is that so?