【发布时间】:2019-07-29 16:44:44
【问题描述】:
.html
<div *ngFor="let p of (products$ | async)?.result.categories.ShoppingCart;">
{{p.price}}
</div>
.ts
this.products$ = this.bikeShopService.get();
邮递员
{
"result": [
{
"categories": [
{
"ShoppingCart": [
{
"id": 1,
"name": "Golf Clubs",
"price": "125",
}]}]}
错误类型错误:无法读取未定义的属性“购物车” 在 Object.eval [作为 updateDirectives] (BikeShopListPage.html:22) 在 Object.debugUpdateDirectives [as updateDirectives] (core.js:23813) 在 checkAndUpdateView (core.js:23209) 在 callViewAction (core.js:23450) 在 execComponentViewsAction (core.js:23392) 在 checkAndUpdateView (core.js:23215) 在 callViewAction (core.js:23450) 在 execEmbeddedViewsAction (core.js:23413) 在 checkAndUpdateView (core.js:23210) 在 callViewAction (core.js:23450)
问:您能告诉我如何访问上述数据吗?
【问题讨论】:
标签: angular typescript rxjs angular7 ionic4