Event.dataTransfer.setDragImage in Angular2

I am implementing drag & drop functionality in Angular2 app. When I try to write this code

public onKitItemDragStart(itemID: number, index: number, event: DragEvent): void {
  let img: HTMLImageElement = document.createElement('img');
  img.src = '.....';
  // image styling here
  event.dataTransfer.setDragImage(img, 0, 0);
}

      

I am getting an error from TSLint:

TS2339: Property 'setDragImage' does not exist on type 'DataTransfer'.

In the meantime, if I do cmd + click on this method, I can see the method setDragImage

in DataTransfer

inferface in the lib.es6.d.ts file (I use storm if it matters).
So why am I getting this error?

One more question - ok, TSLint only checks dependencies, but this code doesn't work, why?

Alternatively, is it possible to simply remove the "translucency" from the ghost image? Since I am reading, I cannot, but maybe there is some way to do this?

+3
angular drag-and-drop


source to share


No one has answered this question yet

Check out similar questions:

244
Importing lodash into angular2 + typescript app
201
Angular2 There are problems in the material dialog. Did you add it to @ NgModule.entryComponents?
194
No provider for TemplateRef! (NgIf & # 8594; TemplateRef)
170
When to use interface and model in TypeScript / Angular2
128
Angular2 Exception: Cannot bind to 'routerLink' because it is not a known native property
110
Angular2 RC6: '<component> is not a known element'
84
Angular2 @ Property Injection with get / set
57
Angular2 table rows as component
55
is there an alternative for ng-disabled in angular2?
44
angular2 style manual - dollar sign property?



All Articles
Loading...
X
Show
Funny
Dev
Pics