[Angular] Import problem - scheduler is undefined


#1

Hello,

Using an old licence of dhtmlx (scheduler v5.3.11), for our project we import manually in an assets folder the codebase part of the licence.

I did a componnent like in the “Angular practice course” but when I am showing it, i have a message like :
ERROR TypeError: src_assets_scheduler_dhtmlxscheduler__WEBPACK_IMPORTED_MODULE_1__.scheduler is undefined

To import it, I use :

import{ scheduler } from ‘src/assets/scheduler/dhtmlxscheduler’;

And I use it like this : scheduler.init(this.schedulerContainer.nativeElement, this.selectedDate, “day”);

I hope that I could find some help.
(note : using the free version, with npm install, is working fine, and the method with manually imported codebase in assets is working fine with gantt)


#2

Hello @tagzk ,

In old versions there is no way to manually import scheduler as variable, and you have to import scheduler module, and manually declare scheduler as variable, like follows:

import  ‘src/assets/scheduler/dhtmlxscheduler’;

declare let scheduler: any;

If it doesn’t help, could you please provide a simplified demo(as post or in PM) with all necessary files(excluding scheduler sources) and run instructions, that I will be able to run locally and reproduce the issue?

Kind regards,


#3

Thank you it worked.
I didn’t need to declare a variable in my component. I directly used scheduler.init(…) and it worked well