我有一个模型,它的结构中有一个列表和一个枚举属性,如下所示:
export class myModel {
Items: any[]=[];
ItemsType: ItemType;
}
我想用 ng-container 和 ng-template 在模板中显示我的模型列表,但是 ng-template 的内部内容没有显示在我的结果中我的模板是这样的:
<nb-accordion>
<ng-container *ngFor="let model of myModels">
<ng-template [ngIf]="model.itemType == 0">
<nb-accordion-item *ngFor="let item of model.Items">
<nb-accordion-item-header>
...some content
</nb-accordion-item-header>
<nb-accordion-item-body>
...some content
</nb-accordion-item-body>
</nb-accordion-item>
</ng-template>
<ng-template [ngIf]="model.itemType == 1">
<nb-accordion-item *ngFor="let item of model.socialNetworkItems">
<nb-accordion-item-header>
...some content
</nb-accordion-item-header>
<nb-accordion-item-body>
...some content
</nb-accordion-item-body>
</nb-accordion-item>
</ng-template>
</ng-container>
</nb-accordion>
你能帮助我吗?