Reputation: 821
I need to get an ID of the draggable Element
I'm using ng2_dnd I tried in method OnDragStart to get ID like this
<li dnd-draggable [dropZones]="['doc']" [dragEnabled]="true" id="id01" (onDragStart)="getDraggableId($event)">Div 12</li>
and in typescript side I call my method getDraggableId
getDraggableId(event){
this.draggableIdGrid = $(event).attr('id');
console.log("get draggablke " + this.draggableIdGrid);
}
should I use ElementRef ?
thanks
Upvotes: 1
Views: 1055
Reputation: 23506
Looking at the source code I came to the conclusion that this should work:
getDraggableId(event){
this.draggableIdGrid = event.mouseEvent.target.id;
console.log("get draggable " + this.draggableIdGrid);
}
Upvotes: 2