0

I am using ngbPopover like following

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

But I want to use this in a *ngfor loop.

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>

but it did not work.

barteloma
  • 6,403
  • 14
  • 79
  • 173
  • 1
    See https://stackoverflow.com/questions/44440879/dynamic-template-reference-variable-inside-ngfor-angular-2. This question is almost identical – Kurt Hamilton Feb 07 '20 at 12:08
  • The problem with your solution is that you cannot create a dynamic template reference – Kurt Hamilton Feb 07 '20 at 12:09
  • Does this answer your question? [Dynamic template reference variable inside ngFor (Angular 2)](https://stackoverflow.com/questions/44440879/dynamic-template-reference-variable-inside-ngfor-angular-2) – Wand Maker Feb 07 '20 at 12:27

0 Answers0