twitter-bootstrap - Angular 与 Bootstrap 弹出窗口。如何在生成的弹出框主体中应用绑定(bind)?

标签 twitter-bootstrap angularjs

我想使用 Bootstrap 弹出窗口作为对话框。

    <a popover href="#" 
        data-toggle="popover" title="" 
        data-html="true" 
        data-content=
           "<p>Are you sure? {{contact.FirstName}} will be removed!</p>
            <button class='btn'>Yes</button>
            <button ng-click='cancel()' class='btn'>Cancel</button>" 
        data-original-title="Remove Contact">Remove</a>

JS:

var ang = angular.module("ang", []);

ang.controller("angCtrl", function($scope) {
    $scope.contact = {
            Id: 1,
            FirstName: "John",
            LastName: "Doe"
        };

    $scope.cancel = function() {
        console.log('Cancel called');
    };
});

ang.directive("popover", function() {
    return {
        restrict: "A",
        link: function (scope) {
            scope.$watch("contacts", function () {
                $("a[data-toggle=popover]")
                .popover()
                .click(function (e) {
                    e.preventDefault();
                });
            });
        }
    };
});

问题是 bootarap 在 Angular 应用其绑定(bind)后生成 popover html。如何包含新生成的弹出窗口?

提前致谢!

最佳答案

http://mgcrea.github.io/angular-strap/#/popover 弹出指令/popover.js

获取外部 html 部分(或内联 ng-template)并用其内容填充弹出窗口。

关于twitter-bootstrap - Angular 与 Bootstrap 弹出窗口。如何在生成的弹出框主体中应用绑定(bind)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16759351/

相关文章:

javascript - 由于 MIME 类型不匹配,功能被阻止(X-Content-Type-Options : nosniff)

twitter-bootstrap - 如何使用 Bootstrap 框架将表单放入弹出框?

html - 使用 Bootstrap 4 垂直对齐嵌套行

javascript - HammerJS 连续拖动(释放后拖动)

javascript - AngularJs http get response is undefined 但是数据存在于成功函数中

javascript - 数据切换和数据目标未按预期工作

html - CSS z-index 在我的 Rails 5 应用程序中表现异常

javascript - 是否可以在不使用 JSPDF、Phantom 等的情况下将 HTML 导出为 PDF 或在 AngularJs 中生成 PDF

javascript - ng-hide 不与 setInterval 一起使用

javascript - 摆脱不相关的控制台错误(404(未找到))