手动隐藏ng2-bootstrap pop-over

时间:2017-09-08 06:06:47

标签: angular popover bootstrap-popover

<template #popDefinitionsTemplate>
    <h4>{{definitions.title}}</h4>
    <i class="fa fa-times"></i>
    <hr>
    <div [innerHtml]="getDefinitionsPopoverContent()"></div>
</template>
<button class="btn btn-secondary btn-finish-later pull-right" 
        [popover]="popDefinitionsTemplate"
        placement="bottom">
    <i class="fa fa-info-circle"></i> 
</button>

我有这个代码用于在我的页面中显示popover。我想在标题旁边的关闭按钮上包含一个隐藏的手册,如下所示:

<i class="fa fa-times" (click)="popover.hide()"></i>

我不太确定如何实施这个。

请注意,这是https://valor-software.com/ngx-bootstrap/#/popover#popover-config

1 个答案:

答案 0 :(得分:0)

现在正在运作:

<template #popDefinitionsTemplate>
    <h4>{{definitions.title}}</h4>
    <i class="fa fa-times" (click)="popDefinitions.hide()"></i>
    <hr>
    <div [innerHtml]="getDefinitionsPopoverContent()"></div>
</template>
<button #popDefinitions="bs-popover" class="btn btn-secondary btn-finish-later pull-right" 
        [popover]="popDefinitionsTemplate"
        placement="bottom">
    <i class="fa fa-info-circle"></i> 
</button>

好事我偶然发现了这个帖子:https://github.com/valor-software/ngx-bootstrap/issues/1477