How to add angular directive to full calendar event

雨燕双飞 提交于 2020-01-02 07:08:06

问题


I'm using Angular-UI Calendar (angular version of Arshaw's fullcalendar) and on EventRender I would like to add a Angular-UI-bootstrap popover to the event element.

I have tried these (using coffeescript):

    eventRender: (event, element) ->
        element.find(".fc-event-inner").wrap("<div popover='I appeared on mouse enter!' popover-title='The title.' popover-trigger='mouseenter'></div>")

and

    eventRender: (event, element) ->
        element.find(".fc-event-inner").wrap($compile("<div popover='I appeared on mouse enter!' popover-title='The title.' popover-trigger='mouseenter'></div>")($scope))
        $scope.$apply()

But neither of those seem to be doing anything. I guess the problem with first one at least is that the event is rendered after angular has done it's magic already. But the second one didn't help either. With some static element the popover is working correctly.


回答1:


Got it working :)

eventRender: (event, element) ->
    element.attr('popover', "Finally it's working")
    element.attr('popover-title', 'Hello world')
    element.attr('popover-trigger', 'mouseenter')
    $compile(element)($scope)


来源:https://stackoverflow.com/questions/24969445/how-to-add-angular-directive-to-full-calendar-event

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