是否可以在事件上触发popover指令?我正在尝试寻找一个字符串字符并触发一个自定义模板,但是,我无法找到一种方法绕过它,我只看到附加到按钮的自定义属性。
答案 0 :(得分:2)
您可以使用popover-is-open
显示特定事件的弹出窗口。
这是一个示例,其中超时用于模拟显示弹出窗口的事件:
标记:
<div ng-controller="PopoverDemoCtrl as vm">
Wait for 3 seconds for the event to happen...
<div uib-popover="Read the message!"
popover-title="Hello World!"
popover-placement="bottom"
id="popover"
class="btn btn-default spaced"
popover-is-open="vm.showPopover">
Popover
</div>
</div>
JavaScript的:
function PopoverDemoCtrl($timeout) {
var popoverDemoCtrl = this;
popoverDemoCtrl.showPopover = false;
$timeout(function () {
popoverDemoCtrl.showPopover = true;
}, 3000);
}
PopoverDemoCtrl.$inject = ['$timeout'];
angular
.module('myApp', ['ui.bootstrap'])
.controller('PopoverDemoCtrl', PopoverDemoCtrl);