【发布时间】:2020-12-31 08:10:14
【问题描述】:
getDetails() 方法返回一个 Details[] 并使用该数组和一个 name 属性,我将其传递给另一个 http 调用
Details {
name: String;
详情
getDetails()
return this.https.get("/someValue") //this return Details[] from here I have to take name property
返回
{name : hello}
信息
getInformations(name:string) {
return this.https.get("/anotherValue"+"?"+ name)
}
我正在尝试首先调用getDetails() 并将名称属性传递给
Information{
Hieght:string
age:string
}
getInformations()
this.getDetails().pipe(mergeMap(x =>
this.getInformations(x.name)).subscribe((inforamtionResults:Information[])=>{
console.log("Checking Informations"+inforamtionResults.length)
返回
{height:160,
age: 23
}
这不起作用,因为 x 值是一个数组。如何迭代数组并将数组属性作为参数传递?
【问题讨论】:
标签: angular typescript rxjs rxjs6