我有一个打字稿,可以对java类中的API方法进行调用。此方法返回地图列表。
Typescript文件看起来像这样:在这里,我试图从[ { _id: 5f77bc653887221a703415df,
watercrafts:
[ { _id: 5f77bc653887221a703415d3,
class: 'sail',
name: 'Gone with the Wind',
__v: 0 } ] },
{ _id: 5f77bc653887221a703415e0,
watercrafts:
[ { _id: 5f77bc653887221a703415d4,
class: 'yatch',
name: 'Liquid Gold',
__v: 0 } ] },
{ _id: 5f77bc653887221a703415e1,
watercrafts:
[ { _id: 5f77bc653887221a703415d5,
class: 'ship',
name: 'Jenny',
__v: 0 } ] },
{ _id: 5f77bc653887221a703415e5,
watercrafts:
[ { _id: 5f77bc653887221a703415dd,
class: 'yatch',
name: 'Audrey',
__v: 0 } ] },
{ _id: 5f77bc653887221a703415e5,
watercrafts:
[ { _id: 5f77bc653887221a703415dc,
class: 'sail',
name: 'Swell Shredder',
__v: 0 } ] },
{ _id: 5f77bc653887221a703415e5,
watercrafts:
[ { _id: 5f77bc653887221a703415de,
class: 'ship',
name: 'Jenny IV',
__v: 0 } ] } ]
中检索数据,但是当我循环遍历它时,它显示了[Object Object],我想看看需要做什么。打字稿文件端从Java类检索数据集。
dataBody
Java类:
*public populatePeople(hyperfindId: number) {
this.getGridInstance()
//this.peopleList= [];
this.personIds = [];
this.personNameById = new Map<string, string>();
this.pokerEntryService.getPeopleByHyperfind(hyperfindId, this.tbSite, this.tbDivision, this.tbDepartment).subscribe((data)=>{
let dataBody = JSON.parse(JSON.stringify(data.body));
//Need to retrieve data here.
if(dataBody.maxExceeded === true){
this.showError = true;
this.alertService.createAlert('WARNING', this.edapLocaleConvertor.convertLocaleMessage('peopleEditor.maxPeopleExceeded'));
}
},
err => {
this.showErrorMessage(err);
});
}**
答案 0 :(得分:0)
此问题已解决。我将哈希图更改为使用值的对象。现在工作正常。