1

我想写一个小部件,它会显示在按钮单击。 这是我想要实现的jQuery表示形式。 jQuery (This is not my code. Found this one on net) 我不知道如何继续发展。该指令是否需要元素或属性或其他内容。 我还没有测试过这个,因为我不知道要怎么做。这是我计划要做的。使用jQuery的角度小部件

angular.module('common').directive('shareModal',function(){ 

return { 
    restrict: 'E', 
    show: '=', 
    transclude: true, 
    replace: true, 
    template: '', 
    link: function (scope, elem, attrs) { 

     $(elem).click (function() { 
      var $this = $(this); 
      $("#background").css({ 
       "opacity": "0.3" 
      }).fadeIn("slow"); 

      $("#large").html(function() { 
       $('.ttip').css({ 
            left: $this.position() + '20px', 
            top: $this.position() + '50px' 
           }).show(500) 

      }).fadeIn("slow"); 

      $('.note').on('click', function() { 
       $('.ttip').hide(500); 
       $("#background").fadeOut("slow"); 
       $("#large").fadeOut("slow"); 

      }); 
      $("#large").click(function() { 
       $(this).fadeOut(); 
      }) 
     }) 
    } 
}}); 

在此先感谢。

更新: 自定义弹出式窗口是我想要实现的。 Custom Popover

+0

此外,得到一个 未知提供商:$ popoverProvider < - $酥料饼< - shareModalDirective错误。 错误我相信是由于没有[控制器](https://docs.angularjs.org/error/$injector/unpr?p0=scopeProvider%20%3C-%20scope%20%3C-%20shareModalDirective) – batmaniac7 2014-09-29 23:51:44

回答

0

我通过注射模块固定它mgcrea.ngStrap“

+0

哇!我已经忘记了这一点。感谢更新。 – batmaniac7 2015-09-10 16:27:55