Hide Angular UI Bootstrap popover when clicking outside of it

后端 未结 12 2184
野趣味
野趣味 2020-11-30 07:37

I am trying to manually close a bootstrap popover to get it to close when I click anywhere on the document or body that isn\'t the popover.

12条回答
  •  难免孤独
    2020-11-30 07:37

    Since Angular UI Bootstrap 1.0.0, there is a new outsideClick trigger for tooltips and popovers (introduced in this pull request. In Angular UI Bootstrap 2.0.0, the popover-trigger has been modified to use angular expressions (Changelog), so the value has to be put in quotes. This code will work with current versions of angular-ui:

    +

    This code will work with old versions of Angular UI Bootstrap (before 2.0.0):

    +

提交回复
热议问题