1

I would like to use the Angular UI Bootstrap Popover.

The documentation states, that the trigger can be either mouseenter, click or focus. In my situation I would like to show the popover on a input-field if a back end calculation fails. How can I trigger the popover to show in code?

dhrm
  • 14,335
  • 34
  • 117
  • 183
  • possible duplicate of [Good way to dynamically open / close a popover (or tooltip) using angular, based on expression?](http://stackoverflow.com/questions/20939754/good-way-to-dynamically-open-close-a-popover-or-tooltip-using-angular-based) – Petr Peller Jul 12 '15 at 21:05
  • This was already asked many times on SO. Today I just published a directive that allows the manual control of popovers: http://stackoverflow.com/a/31372487/190438 – Petr Peller Jul 12 '15 at 21:06

1 Answers1

1

You can trigger the click event (or other based on your config) with $("#btn-id").click()

Mavlarn
  • 3,807
  • 2
  • 37
  • 57
  • 1
    ^ Except please don't use jquery $. – gsalisi Mar 26 '15 at 08:19
  • You can also trigger with angular way: angular.element('#btn-id').trigger('click'); – Mavlarn Mar 26 '15 at 08:21
  • It this really the best solution? Using this approach, the uses will dismiss the popover, when clicking the input field again, right? – dhrm Mar 26 '15 at 12:10
  • The popup will be triggered with click event, so I think this is the most easy way.For ui-bootstrap, the popup div is generated when you click(or hover) the directive, so you can not control the popup div with something like ng-show. – Mavlarn Mar 26 '15 at 12:14