Angular UI Popover加载自定义模板

时间:2014-04-08 12:41:22

标签: angularjs

我正在使用Angular UI Bootstrap popover。而不是给我想要从Div或html模板加载弹出内容的文本。这是我正在使用的示例指令

app.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
        });
    }
};

});

<button popover-placement="bottom" **popover**="On the Bottom!" class="btn btn-default">Bottom</button>

如何从Div或任何HTML模板获取自定义文本?

1 个答案:

答案 0 :(得分:0)

您可以直接使用popover-template="your-template.html"以及该按钮的其他属性,因为您已经在使用角度引导版本,这应该不是问题