angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

uib-popover not closing on outside click #6458

Closed kjartanvalur closed 7 years ago

kjartanvalur commented 7 years ago

I´m using the Angular UI Bootstrap Popover, but I´m unable to get it to close on outside click. I´m using the outsideClick trigger (popover-trigger="outsideClick") Why is this not working?

  <button uib-popover-template="'myPopoverTemplate.html'"  
   popover-placement="right"class="btn btn-default"
   popover-trigger="outsideClick">Click Me</button>

PLUNKER Stack Overflow

AngularPlayer commented 7 years ago

I think it's because on new release you have to do : popover-trigger="'outsideClick'">Click Me</button>

Or use something like $scope.myTrigger = "outsideClick" then popover-trigger="myTrigger">Click Me</button>

In your case it's 'click' (default) trigger that is used because the directive doesn't recognize your parameter so the popover open on click but not close on outsideClick :)

kjartanvalur commented 7 years ago

haha, Thanks @AngularPlayer

jeserkin commented 7 years ago

So this popover-trigger="outsideClick" assigns closing trigger, when in docs for 1.2.5 version it says following:

popover-trigger (Default: click) - What should trigger a show of the popover? Supports a space separated list of event names (see below).

saijayaprakash commented 6 years ago

We can use a small hack, add an attribute tabindex="-1" and popover-trigger="focus" to make it work