我的for循环正在打印最后一个元素,我需要在for循环内打印每个元素。
for(let i=0; i< this.trc.length; i++){
this.selectTableService.getSelectedTable(this.ticker, this.trc[i]).subscribe(data=>{
this.objectKeys(data).forEach(tkey => {
var tableData = data[tkey];
var dataList = Object.keys(tableData).map(key => tableData[key]);
var tempData = dataList.map(d => Object.keys(d).map(key => d[key]))
var tempcontents = {};
if (tempData && tempData.length) {
var firstData = tempData[0];
firstData.forEach((content, ind) => {
var resultData = {};
tempData.forEach((content, index) => resultData[index] = content[ind]);
tempcontents[ind] = resultData;
})
}
this.contents = tempcontents;
});
});
}