【发布时间】:2021-05-19 05:46:21
【问题描述】:
我有以下数据集,我正在尝试循环访问。我也有执行循环的功能,但运行应用程序时看不到控制台日志
{
"header": {
"statuscode": "0",
},
"calculateAVAFLoanAdjustment": {
"responseCode": null,
"responseDescription": null,
"calculatorResults": {
"calculatorResult": [
{
"newCalculatedInstallmentsNo": "63",
"newContractEndDate": "20260725",
"newResidual": "24031.28",
"newInstalment": "5713.38",
"newTerm": "72",
"outBalanceAvaf": null,
"restructureType": "balloon"
}
]
}
}
}
calculateAVAFLoanAdjustment() {
this.avafService.CalculateAVAFLoanAdjustment({accountNumber: '555666'}).subscribe((resp)=>{
this.confirmData = resp.calculateAVAFLoanAdjustment;
for(let i = 0; i < this.confirmData; i++) {
this.calculatorResults = this.confirmData[i].calculatorResults;
console.log("calculatorResults: "+this.calculatorResults)
for(let j = 0; j < this.calculatorResults; j++) {
this.calculatorResult = this.confirmData[i].calculatorResults[j].calculatorResult;
console.log("calculatorResult: "+this.calculatorResult)
}
}
})
}
知道为什么控制台日志不打印任何数据吗?
【问题讨论】:
-
@SiddAjmera 我在控制台中没有看到任何错误
-
@SiddAjmera 是的,我看到了。我需要另一种解决方案才能进入对象
-
所以你需要
calculatorResult数组中每个项目的所有属性的总和是吗? -
@SiddAjmera 是的,这是正确的
标签: angular