Surya Surya - 2 months ago 24
AngularJS Question

Show/Hide tooltip on button click

How to stop/block tooltip from hiding on

mouseout
/
mouseleave
in angular-tooltips?

I need to show and hide the tooltip on button click instead.

Answer
   app.directive('tooltip', function(){
        return {
            restrict: 'A',
            link: function(scope, element, attrs){
                $(element).hover(function(){ // or you can use click instaed of hover
                    // on mouseenter
                    $(element).tooltip('show');
                }, function(){
                    // on mouseleave
                    $(element).tooltip('show'); //or you can remove this one
                });
            }
        };
    });