[
{
"dueAmount": 400,
"paidAmount": 0,
"balanceAmount": 400,
"invoiceNo": "VA019_203829",
"planName": null,
"schemeName": null,
"connectionStatus": null
}
]
I'm getting this response from postman. But when i try to read these contents from my page, it returns "Undefined"
$http({
method:'POST',
url: 'http://10.10.1.200:8081/SelfCare/customer/getInvoiceDetails',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
data: JSON.stringify(getID)
}).then(function (response) {
$scope.invoice = response.invoiceNo;
alert($scope.invoice);
}
its always alerting undefined
response.data[0].invoiceNo. Your response will be encapsulated intodata.console.log(response)inthen. It should work withresponse.data[0].invoiceNo.console.logthanalert.