Good way to dynamically open / close a popover (or tooltip) using angular, based on expression?

前端 未结 6 1264
既然无缘
既然无缘 2020-12-01 07:50

I have a form that is wired into angular, using it for validation. I am able to display error messages using ng-show directives like so:



        
6条回答
  •  鱼传尺愫
    2020-12-01 08:27

    For ui.bootstrap 0.13.4 and newer:

    A new parameter (popover-is-open) was introduced to control popovers in the official ui.bootstrap repo. This is how you use it in the latest version:

    
       Click me to show the popover!
    
    

    For ui.bootstrap 0.13.3 and older:

    I just published a small directive that adds more control over popovers on GitHub:
    https://github.com/Elijen/angular-popover-toggle

    You can use a scope variable to show/hide the popover using popover-toggle="variable" directive like this:

    
       Popover here
    
    

    Here is a demo Plunkr:
    http://plnkr.co/edit/QeQqqEJAu1dCuDtSvomD?p=preview

提交回复
热议问题