8

当悬停在全日历项目上时,我试图显示 angular-strap 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;
  }
};

然后我有一个弹出框正文模板:

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

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

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

4

1 回答 1

9

我有一个可行的解决方案;popover 的作用域可以通过以下方式访问popover.$scope

popover.$scope.event = event

工作的笨蛋:

http://plnkr.co/W8n6LxsLCyZFO6ufPHvW

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

于 2014-05-29T15:27:05.870 回答