【问题标题】:Angular UI Popover load custom templateAngular UI Popover 加载自定义模板
【发布时间】:2014-04-08 12:41:21
【问题描述】:

我正在使用 Angular UI Bootstrap 弹出框。我不想给出文本,而是从 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 模板中获取自定义文本?

【问题讨论】:

    标签: angularjs


    【解决方案1】:

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

    【讨论】:

    • 我试过了,但它不起作用。我正在使用最新版本的引导 ui。我应该使用哪个版本?
    • @ChesterRivas 我正在尝试解决类似的问题。这里有一些工作示例(但它不是最新版本的引导 ui)。 plnkr.co/edit/ddBU1wme46qOKqVPXewo?p=preview
    猜你喜欢
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    • 1970-01-01
    • 2019-06-06
    • 2014-07-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多