Angular4 and method addMarkers

Hi,

I’m using the gantt library for Angular4, installed as described here: dhtmlx.com/blog/dhtmlx-gantt-ch … framework/
which works fine so far.
Now I want to use markers, which are marked as “pro” in the API Docs (i also tried to use it with the free version and it really did not work). So I downloaded the pro trial to test the markers, because i want to know it’s working before buying it. However, the trial is a .js-file, so i manually created a package.json to integrate it into my Angular project. In my Angular project, i imported the new dependency in the package.json as
“dhtmlx-gantt”: “file:path/to/trial”
for @types/dhtmlxgantt i still use
@types/dhtmlxgantt”: “^4.0.34”
as proposed in the Documentation.
But still, if I use the method “addMarker”, I get the following error at runtime: “TypeError: gantt.addMarker is not a function”. What could be the cause for this problem? Do I have to change the @types/dhtmlxgannt as well? Do I include the trial files wrong? What else?

I’d really appreciate any kind of hint what to try next.

hpk

Hello,

Markers are not required PRO license. You just need to include the ext/dhtmlxgantt_marker.js file on the page to start using it.

Hi,

thanks for your quick reply. You posted the solution for Angular.js projects, I am working with Angular 4. However, your answer helped me to figure it out. If anyone is interested, this is how it works:
I still use the npm dependency that was described in the tutorial for Angular4 (dhtmlx.com/blog/dhtmlx-gantt-ch … framework/), for my component that needs the marker I use
import ‘dhtmlx-gantt/codebase/ext/dhtmlxgantt_marker’;
instead of
import ‘dhtmlx-gantt’;
This works fine.

hpk

1 Like