Html 如何制作嵌套的ngFor?[角度和离子]
我有一个嵌套的NGF,用于渲染每个区域的项目。我怎样才能实现我的目标?如果我将第二个ngFor向上移动到ion段按钮中,它就会工作,但所有这些项目都会在我的按钮中渲染,这不是我想要的 HTML {{area.Descriptions[0].Description} {{item}} 试试这个:Html 如何制作嵌套的ngFor?[角度和离子],html,angular,ionic-framework,Html,Angular,Ionic Framework,我有一个嵌套的NGF,用于渲染每个区域的项目。我怎样才能实现我的目标?如果我将第二个ngFor向上移动到ion段按钮中,它就会工作,但所有这些项目都会在我的按钮中渲染,这不是我想要的 HTML {{area.Descriptions[0].Description} {{item}} 试试这个: <ng-container *ngFor="let verArea of template.Version.Areas"> <ion-row> <
<ng-container *ngFor="let verArea of template.Version.Areas">
<ion-row>
<ion-col size="12">
<!-- This ngFor works -->
<ion-segment
scrollable
(ionChange)="onAreaChange($event)"
value="{{ template.Version.Areas[0].Descriptions[0].Description }}"
>
<ion-segment-button
*ngFor="let area of template.Version.Areas"
value="{{ area.Descriptions[0].Description }}"
>
<ion-label>
{{ area.Descriptions[0].Description }}
</ion-label>
</ion-segment-button>
</ion-segment>
</ion-col>
</ion-row>
</ng-container>
你到底想要什么?如果要迭代area.items,需要将其放入另一个*ngFor中。如果你想让它与按钮分开,你可以简单地将ion行包装在@BunyaminCoskuner中,如果你把它作为一个答案发布,我可以将它标记为一个答案。成功了!