问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/23912227/how-to-pass-data-to-angular-strap-popover