わかりました、これはひどいハックだと確信していますが、ここに行きます。ポップオーバー テンプレートがすべて popover クラスを使用し ( data-template 属性を持つカスタム テンプレートを使用していない場合は使用する必要があります)、それらをトリガーするボタンの兄弟であると仮定します ( container 属性です)、次のディレクティブをポップオーバー ボタンに適用できます。注: これは、ポップオーバーとポップオーバー ボタンの親要素に一意の ID があることを前提としています。
angular.module('yourApp.directives', []).directive('rmPopovers',
function($document,$rootScope,$timeout,$popover) {
return {
restrict: 'EA',
link : function(scope, element, attrs) {
var $element = $(element);
$element.click(function() {
$('.popover').each(function(){
var $this = $(this);
if($this.parent().attr('id') != $element.parent().attr('id'))
{
$this.scope().$hide();
}
}
);
});
}
}
}
);
その後
<button type="button" bs-popover rm-popovers [your data attribs here]>Button!</button