I am Rendering the Below Text boxes Dynamically,I want to open popover for each text box and only one popover should be opened at a time.
This is the markup for rendering the text boxes and the popover
<!-- for rendering dynamic fields -->
<div>
<div *ngFor="let field of fieldsInfo">
<div class="form-group">
<label class="required" for="field?.FieldName">{{field?.DisplayName}}</label>
<input [type]="text" [id]="field?.FieldName" class="form-control" [formControlName]="field?.FieldName" [ngModel]="field?.Value" />
<template #popContent></template>
<button type="button" id="{{field?.FieldName}}" class="btn btn-secondary" (click)="openPopover(field.FieldName)" [ngbPopover]="field?.FieldName" popoverTitle="Popover" #p="ngbPopover" placement="right" triggers="manual">open
</button>
</div>
</div>
</div>
This is the typescript code
export class PopoverComponent {
@ViewChild('p') public popover: NgbPopover;
openPopover(data: any){
this.popover.open(data);
}
}
The issue is when ever i hit any open button, only the popover of the first text box is being displayed and not able to open other popovers , can you tell me what code changes i have to make to make this functionality work