Closed gakshat14 closed 7 years ago
Hi @gakshat14 , thanks!
How are you adding an event to the calendar? Can you share a snippet of the code and how you are using it?
Thanks for your work!
Please find a snippet example. It is working for me
import {CalendarComponent} from 'ap-angular2-fullcalendar';
export class ExpenseComponent implements OnInit {
@ViewChild(CalendarComponent) myCalendar: CalendarComponent;
events = [] // no event when init
calendarOptions:Object = {
events: this.events,
(...)
}
// call this function to update your calendar
updateCalendar() {
this.events = [
{
title: 'All Day Event',
start: '2016-09-01'
},
{
title: 'Long Event',
start: '2016-09-07',
end: '2016-09-10'
}]
let dataSource = {
id:1,
events: this.events
}
this.myCalendar.fullCalendar('removeEventSources'); // remove all data in your calendar
this.myCalendar.fullCalendar('addEventSource', dataSource); //add your data updated
}
}
@lbertenasco is it the correct way to do that?
Hi @alan345 Thanks!
Yes, that is one way to refresh the event sources.
I'm closing the issue since this is a question for StackOverflow/Google and not an issue on the package.
Thank you for the library.
I have been using it and I want to refresh the calendar after adding an event please help me on this front. How can I do this??