I've implemented the Angular-UI calendar to showcase some events. My activity controller interacts with the backend service to fetch the data, which is then bound to the model.
//activity controller
$scope.events = [];
Activities.get()
.success(function(data) {
$scope.activities = data;
populateEvents();
});
function populateEvents() {
$scope.activities.forEach(function(a) {
$scope.events.push({title: a.name, start: a.date, url: a.url});
});
}
$scope.eventSources = [$scope.events];
//index.html
<div class="calendar" ng-model="eventSources" calendar="myCalendar1" config="uiConfig.calendar" ui-calendar="uiConfig.calendar"></div>
Upon loading the calendar initially, I notice that two duplicates of the event are being shown. I'm uncertain if I'm approaching this in the correct manner. Any guidance would be appreciated. Thanks