Is there a way to initialize fullCalendar in an event (such as a click) on Ionic 3, using Angular 4?
This code works when the calendar options are set in a variable:
calendarOptions: Object = {
fixedWeekCount: true,
editable: true
};
However, it doesn't work when called within a function:
buildCalendar(): void{
this.calendarOptions = {
fixedWeekCount: true,
editable: true
};
}
HTML code where the calendar is invoked:
<angular2-fullcalendar
[options]="calendarOptions"
(initialized)="onCalendarInit($event)"></angular2-fullcalendar>
Angular code where buildCalendar is invoked:
getAging(): void {
this.myProvider.getAging()
.subscribe(
(response) => {
//do something...
}, (error) => {
console.log(`Backend returned code ${error.status}, body was: ${error.error}`);
}, () => {
console.log('aging complete');
this.buildCalendar();
}
)
}
PS: getAging() is called upon page load.
I need to initialize fullCalendar after retrieving data from the backend API.