Using FullCalendar methods with AngularUI wrapper

南笙酒味 提交于 2019-12-01 01:59:15

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.

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