如何将数据传递给angular-strap popover

时间:2022-02-02 11:22:23

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

我在悬停在fullcalendar项目上时试图显示角带弹出。

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

我正在使用eventMouseover / eventMouseout回调来显示/隐藏弹出窗口:

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

我的问题是如何将'事件'传递给popover范围?

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

这里是plunker:http://plnkr.co/9c6BDWsYuuWAfI4HnJAH

1 个解决方案

#1


9  

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

我有一个有效的解决方案;可以使用popover访问popover的范围。$ scope:

popover.$scope.event = event

Working plunker:

工作人员:

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

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

不确定这是否是最佳解决方案,所以我会等待一段时间来获得反馈。

#1


9  

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

我有一个有效的解决方案;可以使用popover访问popover的范围。$ scope:

popover.$scope.event = event

Working plunker:

工作人员:

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

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

不确定这是否是最佳解决方案,所以我会等待一段时间来获得反馈。