Hello!
I'm trying to reload events dynamically using subscription to RxJS subject but sometimes get the following exception on page load:
ERROR TypeError: "this.parent.activeView is undefined"
getQuery ej2-schedule.es2015.js:4691
addEvent ej2-schedule.es2015.js:4755
addEvent ej2-schedule.es2015.js:11884
ngAfterViewInit crews-scheduler.component.ts:80
It seems Schedule instance is not always fully instantiated inside AfterViewInit of the parent component.
Do you provide any event that I can catch and start to load scheduler events?
Here is the part of my component:
@ViewChild('scheduleObj', { static: true })
public scheduleObj: SyncfusionScheduleComponent;
ngAfterViewInit() {
this.loadedEvents$.subscribe(events => {// getEvents() fails sometimes here too, but this is not critical since I can skip removing if it is the first load
if (this.scheduleObj.eventBase) {
const existingEvents = this.scheduleObj.getEvents() as any[];
if (existingEvents && existingEvents.length > 0)
this.scheduleObj.deleteEvent(existingEvents);
}
if (events.length > 0)
this.scheduleObj.addEvent(events.map(clone)); // here I get the exception!
});
}