Javascript AngularJS-更改月份时删除事件 问题
我已经设法使用AngularJS将我的事件加载到Javascript AngularJS-更改月份时删除事件 问题,javascript,jquery,angularjs,fullcalendar,Javascript,Jquery,Angularjs,Fullcalendar,我已经设法使用AngularJS将我的事件加载到fullCalendar。当我更改月份视图并且所有事件都消失时,问题就出现了 代码 以下是我用来更改月份视图的代码: //BC - SETS THE MONTH ON THE CALENDAR. $('#calendar').fullCalendar('gotoDate', MyDateString); 以下是我用于将事件添加到日历的代码(这是在控制器页面的页面加载功能中完成的): 结论 如何让事件保留在日历中?您应该尝试@PankajPar
fullCalendar
。当我更改月份视图并且所有事件都消失时,问题就出现了
代码
以下是我用来更改月份视图的代码:
//BC - SETS THE MONTH ON THE CALENDAR.
$('#calendar').fullCalendar('gotoDate', MyDateString);
以下是我用于将事件添加到日历的代码(这是在控制器页面的页面加载功能中完成的):
结论
如何让事件保留在日历中?您应该尝试@PankajParkar的角度版本我正在使用此工具?您应该尝试@PankajParkar的角度版本我正在使用此工具?
var holidays = [];
$scope.eventSources = [{
events: [],
color: '#ffd47f', // an Event Source Option!
textColor: '#3c4756' // an Event Source Option!
}];
$http.get("http://localhost/AceTracker.svc/GetAllEventsByUser?user_id=1")
.success(function (data) {
for (var key in data.GetAllEventsByUserResult) {
if (data.GetAllEventsByUserResult.hasOwnProperty(key)) {
holidays.push(data.GetAllEventsByUserResult[key])
}
}
holidays.forEach(function (hol) { //forEach loop through the holidays array data
$scope.eventSources[0].events.push({ //Push a new object to our eventSOurces array
end: $filter('dateFilter')(hol.HOLIDAY_END),
start: $filter('dateFilter')(hol.HOLIDAY_START),
title: hol.HOLIDAY_TITLE //Set up fields on new object
});
});
});