I have successfully received a json object containing query results from the database. However, I am currently facing an issue where I am unable to access the returned json data one by one.
When I check the console.log
, this is what it shows:
https://i.sstatic.net/KHuz0.png
This is my Angular code:
$scope.peopleList=[];
$http.get("http://localhost/project/public/people_names").then(function(response) {
$scope.peopleList.push(response.data);
});
console.log($scope.peopleList);
Whenever I try to use
console.log($scope.peopleList[0]);
, it keeps showing as undefined
. How can I access the data to print it using ng-repeat
?