【发布时间】:2013-06-18 14:20:33
【问题描述】:
我正在使用 Angular UI Bootstrap 创建一个弹出框,但我找不到在弹出框内添加关闭按钮的选项。
我自定义了弹出框模板以包含关闭按钮。但我仍然无法找到关闭弹出框的函数/事件。将 isOpen 设置为 false 首次起作用,因为它只是覆盖了函数 - 但此后变得无法使用。
<button popover-placement="bottom" popover="test">POPOVER WITH CLOSE<button>
这是模板脚本:
angular.module("template/popover/popover.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/popover/popover.html",
"<div class=\"popover {{placement}}\" ng-class=\"{ in: isOpen(), fade: animation() }\">\n" +
" <div class=\"arrow\"></div>\n" +
"\n" +
" <div class=\"popover-inner\">\n" +
" <button ng-click=\"isOpen = !isOpen()\" class=\"btn-popover-close btn btn-primary\">Close</button>\n" +
" <h3 class=\"popover-title\" ng-bind=\"title\" ng-show=\"title\"></h3>\n" +
" <div class=\"popover-content\" ng-bind=\"content\"></div>\n" +
" </div>\n" +
"</div>\n" +
"");
}]);
我想为关闭按钮编写一个指令来触发“POPOVER WITH CLOSE”按钮的“点击”事件。但我不确定这是否是要遵循的方法。
正确的做法是什么?
【问题讨论】:
-
我还是不敢相信他们还没有实现关闭按钮。
标签: popover angular-ui-bootstrap