Using $popover service in Angular with Fullcalendar

女生的网名这么多〃 提交于 2019-12-11 08:24:04

问题


I have a calendar setup in Angular using FullCalendar. I am now trying to get a popover to show up using javascript only and without any DOM manipulation. I am trying to use the $popover service provided by Angularstrap.

In the options of the calendar I do the following:

eventMouseover: $scope.PopOnEventHover

And the PopOnEventHover is what I am trying to use make the popover appear:

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

The HTML which displays the calendar looks like this:

<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>

Right now I get an error in the console which has a problem with the function I am using to display the popover.

I would appreciate any help or tips. Thanks


回答1:


Replace

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

with

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

And make sure you have $popover service is injected and element is exist.



来源:https://stackoverflow.com/questions/21940245/using-popover-service-in-angular-with-fullcalendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!