Closed patatoid closed 9 years ago
scope.eventSources is the correct code. You do not want to create a tight coupling to the $parent.eventSources variable. What if the end user decides to store their event sources in a variable named allEventSources. Or if the $parent.$parent holds the eventSources object. What scope.eventSources is doing, is binding to the variable passed to the uiCalendar object via the ng-model attribute defined in the directives scope property.
See this line, scope.eventSources is really this object: https://github.com/angular-ui/ui-calendar/blob/master/src/calendar.js#L200
The following scope.eventSources would bind to the allEventSources variable.
//Controller
scope.allEventSources = [
eventSource1,
eventSource2 ];
<!-- html -->
<div ui-calendar="uiConfig.calendar" class="calendar" ng-model="allEventSources"></div>
got it :) thx
https://github.com/angular-ui/ui-calendar/blob/master/src/calendar.js#L204
var sources = scope.eventSources,
should bevar sources = scope.$parent.eventSources,