首页 > 解决方案 > 如何在 Angular for 循环中使用 Angular ngbootstrap 弹出框

问题描述

我正在使用 ngbPopover,如下所示

<ng-template #mytemp>
    <my-editor></my-editor>
</ng-template>
 <button type="button" class="btn" placement="bottom-left" [ngbPopover]="mytemp">
    Show
</button> 

但我想在 *ngfor 循环中使用它。

let items =[ { id:1, settings: "s1" }, { id:2, settings: "s2" }];

<div *ngFor="let item of items">
    <ng-template #item.id>
        <my-editor></my-editor>
    </ng-template>
     <button type="button" class="btn" placement="bottom-left" [ngbPopover]="item.id">
        Show
    </button> 
</div>

但它没有用。

标签: angularng-bootstrap

解决方案


推荐阅读