【发布时间】:2020-04-21 18:16:18
【问题描述】:
我正在使用这样的 api 中的对象。
我可以获取数据,但无法独占获取 ChildSimpleProducts 数组。
这里是product.service函数
getProducts = (): Observable<IProducts[]> => this.http.get<IProducts[]>(`${this.apiUrl + this.productsUrl}`);
这里是组件函数
data: any = [];
productsArray: Observable<IProducts>[];
getProducts() {
this.productService.getProducts().subscribe(data => {
this.data = data;
this.productsArray = data["$values"];
console.log(this.productsArray)
})
}
我已经尝试了一些东西,但不断得到未定义和未定义的对象
【问题讨论】:
-
你试过this.productsArray[0].childSimpleProducts吗?
-
你试过 data.$values;
标签: arrays json angular object