Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 防止基于某个条件的引导popover关闭_Angularjs_Twitter Bootstrap_Angular Strap - Fatal编程技术网

Angularjs 防止基于某个条件的引导popover关闭

Angularjs 防止基于某个条件的引导popover关闭,angularjs,twitter-bootstrap,angular-strap,Angularjs,Twitter Bootstrap,Angular Strap,我创建了一个popover(bs popover from),在点击popover外部后自动关闭。当条件为true时,我想停止关闭popover 我使用了此事件侦听器: $scope.$on('tooltip.hide.before', function(event, ui) { if(something === true){ console.log('HERE'); // Writes HERE on close popover event.preve

我创建了一个popover(bs popover from),在点击popover外部后自动关闭。当条件为
true
时,我想停止关闭popover

我使用了此事件侦听器:

$scope.$on('tooltip.hide.before', function(event, ui) {
    if(something === true){
        console.log('HERE');  // Writes HERE on close popover
        event.preventDefault();
    }
});

但它无法阻止这一事件。有什么解决方案吗?

第一个示例在单击关闭时不会关闭-我使用angular ui做了类似的事情,但必须捕获对文档的单击,并防止它被处理程序处理bs@sambomartin我希望自动关闭功能处于活动状态。我想有条件地阻止它。在('click',函数(e){/**/})上使用$('body');如果要保留popover,请防止默认设置并使用事件visible@sambomartin是的,看来这是唯一的办法。谢谢