如何在元素中声明动态 模板引用变量ngFor
?
我想使用ng-bootstrap中的popover组件,popover代码(带有Html绑定)如下所示:
<ng-template #popContent>Hello, <b>{{name}}</b>!</ng-template>
<button type="button" class="btn btn-secondary" [ngbPopover]="popContent" popoverTitle="Fancy content">
I've got markup and bindings in my popover!
</button>
Run Code Online (Sandbox Code Playgroud)
如何将这些元素包装在里面ngFor
?
<div *ngFor="let member of members">
<!-- how to declare the '????' -->
<ng-template #????>Hello, <b>{{member.name}}</b>!</ng-template>
<button type="button" class="btn btn-secondary" [ngbPopover]="????" popoverTitle="Fancy content">
I've got markup and bindings in my popover!
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
嗯......任何想法?