ngbPopover将不会关闭,并会在加载时打开 [英] ngbPopover will not close and will open on load
本文介绍了ngbPopover将不会关闭,并会在加载时打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一旦页面加载或不触发按钮,我想显示弹出窗口,并且永远不会关闭 我在Angular中使用ngbPopover.
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>
在此处使用参考: https://ng-bootstrap.github. io/#/components/popover/examples
推荐答案
您必须将此属性添加到按钮中:
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>
在您的组件类中:
ngOnInit(){
if(!pop.isOpen()){
pop.open();
}
}
这篇关于ngbPopover将不会关闭,并会在加载时打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文