Adeel Khan Adeel Khan - 7 days ago 4
AngularJS Question

angularjs response data does not show in console

i have below code i but data not show in console log please help me i am new in angular.. AND how to show data in HTML

this.$http.get(properties.client+'/123')
.then(response => {
$scope.clientdata= response.data;

console.log($scope.clientdata.address);
});


address array dose not show in console log,i don't know why RESPONSE BELOW

[{ "_id": "123",
"__v": 1,
"history": [],
"address": {
"street_address": "adsf",
"state": "adsf",
"zip_code": "adsf",
"phone_number": "asdf",
"country": "ads",
"city": "asdf",
"site_name": "adsf",
"_id": "123123",
"geolocation": {
"coordinates": [],
"type": "Point"
},
"location": {
"latitude": null,
"longitude": null
},
"id": "5835baaa71a30ca8319b6e36"
},
"current_status": "Assigned",
"time": 0
}]

Answer

Your clientdata is an array as per the post, try

console.log($scope.clientdata[0].address); 

HTML

{{clientdata[0].address}}