I have an angular application where I need to explicitly fire a drag event. I am using AOT - ngc and rollup.
let event1 = new DragEvent();
event1.initDragEvent('dragstart', true, true, null, null, null, null, null, null, null, null, null, null, null, null, null);
this._renderer.invokeElementMethod(this._elementRef.nativeElement, 'dispatchEvent', [event1]);
The code compiles fine and the page loads in the browser. But at runtime, I get this error:
Failed to construct 'DragEvent': 1 argument required, but only 0 present.
Now, I change the code to look like this:
let event1 = new DragEvent('dragstart');
this._renderer.invokeElementMethod(this._elementRef.nativeElement, 'dispatchEvent', [event1]);
Now, the compiler throws and error saying:
Expected 0 arguments, but got 1.
How do I overcome this problem?