Create Hoverable popover using angular-ui-bootstrap

后端 未结 11 1070
渐次进展
渐次进展 2020-12-09 10:45

I have the following code for creating a popover in my template file:



        
11条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 11:04

    html

     
    
    

    directive

    myAppModule.directive('viz', function ($rootScope,$timeout){
        return{
    
            restrict:"A",
            link: function (scope, element, attrs) {
                $rootScope.insidePopover = false;
    
                element.bind('mouseenter', function (e) {
                    $timeout(function () {
                        if (!$rootScope.insidePopover) {
                            element.popover('show');
                         //  attachEvents(element);
                        }
                    }, 200);
                });
    
                element.bind('mouseout', function (e) {
                    $timeout(function () {
                        if (!$rootScope.insidePopover) {
                            element.popover('show');
                         //   attachEvents(element);
                        }
                    }, 200);
                });
    
            }
        }
    });
    

    Note : - Don't forget to include angular-strap after jQuery.js & angular.js

提交回复
热议问题