2016-04-13 48 views

回答

1

也許這個例子可以幫助您與angularjs的popovers,只研究它是如何工作 - >Popover Example

customDirectives.directive('customPopover', function() { 
return { 
    restrict: 'A', 
    template: '<span>{{label}}</span>', 
    link: function (scope, el, attrs) { 
     scope.label = attrs.popoverLabel; 
     $(el).popover({ 
      trigger: 'click', 
      html: true, 
      content: attrs.popoverHtml, 
      placement: attrs.popoverPlacement 
     }); 
    } 
}; 

他使用與CustomComponents一個指令

+0

你的代碼非常適合學習指令,我已經玩了很多。但它仍然是在創建它的元素上發生的彈出式廣告。我如何點擊一個元素,並讓彈出窗口出現在不同的元素上? – NewbornNerd

相關問題