'how to get dropped element ID , dragDrop Angular
i use this function on drop from task planned into task progress
onDrop1(event:CdkDragDrop<string[]>,id:any){
console.log('ondrop progress')
this.updateProgress()
if(event.previousContainer===event.container){
moveItemInArray(
event.container.data,
event.previousIndex,
event.currentIndex
);
}else{
transferArrayItem(
event.previousContainer.data,
event.container.data,
event.previousIndex,
event.currentIndex,
);
}
}
and this is the HTML code
<h1>planned</h1>
<div cdkDropList id="tasks_planned" [cdkDropListConnectedTo]="['tasks_progress']" (cdkDropListDropped)="onDrop($event)"
[cdkDropListData]="tasks_planned">
<div cdkDrag class="drag-item" *ngFor="let tache of tasks_planned">
{{tache.description}}
</div>
</div>
<h1>progress</h1>
<div cdkDropList id="tasks_progress" [cdkDropListConnectedTo]="['tasks_completed']" (cdkDropListDropped)="onDrop1($event,5)"
[cdkDropListData]="tasks_progress">
<div cdkDrag class="drag-item" *ngFor="let tachep of tasks_progress" cdkDrag [cdkDragData]="tachep.id">
{{tachep.description}}
</div>
</div>
so i want to get the id of the element , to be draged
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|