Reputation: 4177
I have used popover
with popover-trigger
= 'outsideclick
' and inside a popover i used a custom directive to render html.
Now when i click a button inside popover the popover vanishes.
I have created a striped down version of the problem here Link of problem
What am i doing wrong ? Why is popover getting vanish? How to fix it?
Upvotes: 1
Views: 673
Reputation: 1223
You can change ng-if to ng-show, it will work.
var template =
'<ul>' +
'<li data-ng-repeat="node in ' + appModel + '" >' +
'<button data-ng-show="node.collapsed" data-ng-click="' + treeId + '.selectNodeHead(node)">- click me</button>' +
'<button data-ng-show="!node.collapsed" data-ng-click="' + treeId + '.selectNodeHead(node)">+ click me</button>' +
'</li>' +
'</ul>';
This issue maybe due to ng-if removes or recreates a portion of the DOM tree, still if you want to use with ng-if you can use $event.stopPropagation();
in your click function so the event is not propagated.
From: https://stackoverflow.com/a/37674704/3279156
Upvotes: 2
Reputation: 282
Add one more attribute to your button which triggers popover, trigger="focus"
<button popover-trigger="'outsideClick'" trigger="focus" uib-popover-template="'tree.html'" type="button" class="btn btn-default">Popover</button>
Upvotes: -1