Using Bootstrap Tooltip with AngularJS

后端 未结 19 1526
抹茶落季
抹茶落季 2020-12-07 10:40

I am trying to use the Bootstrap tooltip in an app of mine. My app is using AngularJS Currently, I have the following:

19条回答
  •  春和景丽
    2020-12-07 11:01

    Because of the tooltip function, you have to tell angularJS that you are using jQuery.

    This is your directive:

    myApp.directive('tooltip', function () {
        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                element.on('mouseenter', function () {
                    jQuery.noConflict();
                    (function ($) {
                        $(element[0]).tooltip('show');
                    })(jQuery);
                });
            }
        };
    });
    

    and this is how to use the directive :

    
    
    

提交回复
热议问题