Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass data to angular-strap popover

I'm trying to show angular-strap popover when hovering on fullcalendar items.

I am using eventMouseover/eventMouseout callbacks to show/hide the popover:

$scope.calendarConfig = {
  defaultView: 'basicWeek',
  eventMouseover: function(event, jsEvent, view) {
    element = $(jsEvent.target).closest('.fc-event');
    popover = $popover(element, {placement: 'bottom', contentTemplate: 'calendar-item-popover.html'});
    popover.$promise.then(popover.show);
  },
  eventMouseout: function() {
    popover.hide();
    popover = null;
  }
};

Then I have a popover body template:

<script type="text/ng-template" id="calendar-item-popover.html">
  <p>Event</p>
  <p>event: {{event | json}}</p>
</script>

My question is how can I pass the 'event' to popover scope?

Here is the plunker: http://plnkr.co/9c6BDWsYuuWAfI4HnJAH

like image 434
cthulhu Avatar asked May 28 '14 12:05

cthulhu


1 Answers

I have a working solution; popover's scope can be accessed with popover.$scope:

popover.$scope.event = event

Working plunker:

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

Not sure if that's an optimal solution, so I will wait some time for feedback.

like image 125
cthulhu Avatar answered Oct 17 '22 05:10

cthulhu