arrays - 在我的控制器数组中检索 1 个变量
问题描述
我的控制器返回一个变量数组。
return response()->json([$newBauxEnCours, $bienPrixEnBaisse]);
我调用 API Laravel 的方法
getProducts(status: string, typeTransac: string): Observable <any> {
let params = new HttpParams();
params = params.append('status', status);
params = params.append('typeTransac', typeTransac);
console.log(params);
if (status !== null && typeTransac !== null) {
// Conversion en nombre
return this.apiClient.get(this.ApiUrl, { params: params});
}else{
console.log('aucune valeur en params')
}
}
ngOnInit(){
this.ArchiveVente$ = this.dataMlsService.getProducts('Vendu', 'Vente');
console.log(this.ArchiveVente$);
}
我的问题是:为什么要在 Angular 中检索我的变量 $newBauxEnCours ?
谢谢
解决方案
试试这样
ngOnInit(){
this.dataMlsService.getProducts('Vendu', 'Vente').subscribe((response: any)=> {
console.log(response);
});
}
推荐阅读
- python - 我无法删除产品
- ios - iOS 订阅 latest_receipt_info
- visual-studio-code - VS Code 无法启动 Bash
- botframework - 创建访问器后无法写入机器人状态属性
- python - ValueError:不支持 ssd_inception_v3。有关与不同版本 TensorFlow 兼容的特征提取器,请参阅 `model_builder.py`
- javascript - 如何使用 v-for vuejs 指令获取元素 ID?
- jmeter - 根据请求为变量赋值
- android - 日历日添加未按预期工作
- typescript - 带有超时毫秒的打字稿重试逻辑
- html - 想要将 span 放在 div 的顶部并更改 html 中的字体