[
{
"dueAmount": 400,
"paidAmount": 0,
"balanceAmount": 400,
"invoiceNo": "VA019_203829",
"planName": null,
"schemeName": null,
"connectionStatus": null
}
]
我收到邮递员的回复。但是,当我尝试从我的页面读取这些内容时,它将返回“ 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);
}
它总是警报未定义
最佳答案
您需要进行更改,将$scope.invoice = response.invoiceNo;
替换为$scope.invoice = response.data[0].invoiceNo;
您的回复将被封装到data
中。