1

我在 Angular 中有一个使用 FullCalendar 的日历设置。我现在正试图让一个弹出框仅使用 javascript 显示,而无需任何 DOM 操作。我正在尝试使用 Angularstrap 提供的 $popover 服务。

在日历的选项中,我执行以下操作:

事件鼠标悬停:$scope.PopOnEventHover

而 PopOnEventHover 是我尝试使用的使弹出框出现的内容:

$scope.alertOnEventHover = function(event, jsEvent, view, $popover, element){
    var myPopover = $popover(element, {
        title: 'My Title',
        content:'My Content'
    });
    myPopover.show();
};

显示日历的 HTML 如下所示:

<h1>Scheduled Content</h1>
View:
<a ng-click="changeView('agendaDay', myCalendar)">DAY</a> |
<a ng-click="changeView('agendaWeek', myCalendar)">WEEK</a> |
<a ng-click="changeView('month', myCalendar)">MONTH</a>
<div ui-calendar="options.calendar"
     calendar="myCalendar"
     ng-model="eventSources"
     bs-popover></div>

现在我在控制台中收到一个错误,这与我用来显示弹出框的功能有问题。

我将不胜感激任何帮助或提示。谢谢

4

1 回答 1

2

代替

var myPopover = $popover(element, {
        title: 'My Title',
        content:'My Content'
    });
    myPopover.show();

var myPopover = $popover(element, {
        title: 'My Title',
        content:'My Content',
        show: true
    });

并确保你有$popover服务被注入并且element存在。

于 2014-02-26T12:51:04.407 回答