Reputation: 45
I want to show the popover once the page load or without trigerring the button and will never close I'm using ngbPopover in Angular.
<button placement="left" (click)="openQuestionnaire()" [ngbPopover]="popContent" >0/4</button>
using the reference here : https://ng-bootstrap.github.io/#/components/popover/examples
Upvotes: 1
Views: 2221
Reputation: 74738
You have to add this property to your button:
[autoClose]="false"
Then your button would look like this:
<button placement="left"
(click)="openQuestionnaire()"
[ngbPopover]="popContent"
[autoClose]="false" >0/4</button>
From the link you shared i found this:
<button type="button" class="btn btn-outline-secondary mr-2"
ngbPopover="What a great tip!"
[autoClose]="false"
triggers="manual"
#p="ngbPopover"
(click)="p.open()"
popoverTitle="Pop title">
Click me to open a popover
</button>
As per your comment, you can trigger it when your component is shown in the page:
<button placement="left"
#pop="ngbPopover"
(click)="openQuestionnaire()"
[ngbPopover]="popContent"
[autoClose]="false" >0/4</button>
in your component class:
ngOnInit(){
if(!pop.isOpen()){
pop.open();
}
}
Upvotes: 1