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

Unable to programmatically stop popover from showing #6470

Open 29er opened 7 years ago

29er commented 7 years ago

Hi, supposedly you are able to use the popover-is-open property to programmatically stop a popover from showing ? I have tried several ways to achieve this but no luck. An example below just checks to see if another popover exists on the Dom, and should stop the current one from opening. I also tried using popover-is-enabled . Ive tried event.preventDefault, return false, , etc and pretty much any variation with no luck. Please give assistance. thanks!

<span class="cell-popover-icon" 
uib-popover-template="'my.html'" 
popover-trigger="none" 
popover-placement="top" 
popover-is-open="$ctrl.popoverIsOpen" 
popover-append-to-body="true" 
ng-click="$ctrl.toggle($event)">
</span>

Angular: ...

toggle( event ) {
        const anotherPopover = document.querySelector('.my-popover')
        if( anotherPopover ){
            this.popoverIsOpen = false
            return false
        } else {
           this.popoverIsOpen = !this.popoverIsOpen
     }   
}

...

VenkatRamReddyK commented 6 years ago

Easiest way to have a mouse-event using uib-popover Look at the below working example ! https://plnkr.co/edit/9oMYadXPNJcRPrig71iF?p=preview