【发布时间】:2021-05-20 18:01:37
【问题描述】:
我得到了这个 JSON。
[
{
"id": 11,
"parent_category": null,
"name": "name11"
},
{
"id": 12,
"parent_category": {
"id": 11,
"name": "name11",
"parent_category": null
},
"name": "name12"
},
{
"id": 13,
"parent_category": {
"id": 11,
"name": "name11",
"parent_category": null
},
"name": "name13"
}
]
我想在parent_category.name 视图中显示parent_category 不为空。
<mat-select formControlName="parent_category">
<mat-option>--</mat-option>
<mat-option *ngFor="let p_g of mydata" [value]="p_g.id">
{{p_g.name}}
</mat-option>
</mat-select>
拜托,你能告诉我如何展示它吗?
【问题讨论】:
标签: json angular typescript