【发布时间】:2022-08-10 11:36:46
【问题描述】:
我的组件中的功能:
searchWithNyckel(){
const formData = new FormData();
formData.append(\'image\', this.updateFormGroup.get(\'updateProduct.image\').value);
this.productService.searchProductNyckel(formData).subscribe(
data => {
this.resForSearch= data
console.log(JSON.stringify(this.resForSearch));
// this.resForSearch.values()
}
)
}
我的服务中的功能:
searchProductNyckel(formData: FormData):Observable<SearchRes[]> {
const url = `https://www.nyckel.com/v0.9/functions/1wx5f2474e1ntc/search`
return this.httpClient.post<SearchRes[]>(url,formData);
}
控制台响应:
{
\"searchSamples\":
[{
\"sampleId\": \"<sampleId>\",
\"distance\": 0.86,
\"externalId\": \"<externalId>\"
}]
}
我需要得到 sampleId 和 distance 的值
标签: arrays angular typescript nyckel