In my app Im trying to fetch the json array from the DB using the $http.get, on execution Im not able see the fetched data on my view. But in my browser console Im able to see the response showing number of json array data:array[5]on expanding each array able to see the entered values in the array. So how can I display the data fetched in my view page.
var brandList=[];
var successCallBack=function(response){
$log.info(response);
brandList=response;
};
var errorCallBack=function(response)
{
$log.info(response);
};
$http({
method:'get',
url:'http://local-serve:8081/route/listMake'})
.then(successCallBack,errorCallBack);
return brandList;
}]);
The response in the entire response object. you need to extract value from it. Try running this URL in the browser. Now using the same URL, here's an example:
In JS,
$http.get('https://jsonplaceholder.typicode.com/photos/1')
.then(function(response){
$scope.title = response.data.title;
})
And in HTML,
<p>
The title is <i>{{title}}</i>
</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With