Categories
How to make a GET request in Angular?
$http.get("lists.php") .then(function(response) { $scope.lists = response.data.lists; console.log($scope.lists); // returns an array }); console.log($scope.lists); // returns an empty array []
Answer the question
In order to leave comments, you need to log in
The request is being processed correctly. It's a matter of asynchrony. At the time of the second console.log get , the request had not yet completed.
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question