How to pass data to angular-strap popover

穿精又带淫゛_ 提交于 2019-12-23 07:48:21

问题


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

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