Using FullCalendar methods with AngularUI wrapper

后端 未结 1 1511
轻奢々
轻奢々 2021-01-07 10:49

I\'m trying to integrate AngularUI\'s calendar wrapper into my application, and the calendar initialization works fine. However, I don\'t see how I can call calendar methods

相关标签:
1条回答
  • 2021-01-07 11:18

    Okay, so it was pretty obvious in the source code, but I didn't understand on first glance. Here's a relevant snippet:

    if(attrs.calendar){
        scope.calendar = scope.$parent[attrs.calendar] = elm.html('');
    }else{
        scope.calendar = elm.html('');
    }
    

    This binds the calendar to the parent scope under the name that you declare when you write the calendar directive in your HTML. e.g.

    <div ui-calendar="options" calendar="my-calendar-name" ng-model="events"></div>
    

    This means I can call on the calendar's methods in my controller's scope. It was a feature implementation that I hadn't even considered yet! We need some docs for this script.

    0 讨论(0)
提交回复
热议问题