gpt4 book ai didi

javascript - 从 json feed Angular 4 中的表中检索数据

转载 作者:行者123 更新时间:2023-12-03 01:33:29 25 4
gpt4 key购买 nike

我有一个返回此结果的函数:

    {id: 20, dateCreation: 1517324655450, auteurCreation: "bel", dateModification: 1530544886148, auteurModification: "user", …}
auteurCreation:"bel"
auteurModification:"user"
coupesTechniquesDescription:Array(1)
0:{id: 15, hauteurReference: 2, commentaireReference: "test"}
length:1
__proto__
:Array(0)
dateCreation:1517324655450
id:20

我想将:coupesTechniquesDescription保存在变量中,目标是获取 coupesTechniquesDescription 列表并使用第一个索引

最佳答案

给你。从 res 中获取对象:

// define the variable above your constructor
private coupesTechniquesDescription;

constructor(...){
this.technicalservice.find(this.id).subscribe((res) => {
this.coupesTechniquesDescription = res.coupesTechniquesDescription[0];

console.log(this.coupesTechniquesDescription);
},
(err) => { console.log("Erreur"); });

}

关于javascript - 从 json feed Angular 4 中的表中检索数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51187216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com