2

draging from parent componenet to some child componenet (of multiple same type childs) i am using (cdkDropListDropped)="drop($event)" to point :

  drop(event: CdkDragDrop<string[]>) {
    console.log(event);// how can i get the instance of target component
    }

<app-parent>
<div cdkDropList [cdkDropListData]="Data" (cdkDropListDropped)="drop($event)"></div>
<app-child cdkDropList></app-child> 
<app-child cdkDropList></app-child> 
<app-child cdkDropList></app-child> 
</app-parent>

but i cant obtain from event the target component;

mordechai
  • 829
  • 1
  • 7
  • 23
  • 2
    "event" is a CdkDragDrop, https://material.angular.io/cdk/drag-drop/api#CdkDragDrop. So, you has event.container -the container where you dropped the item-, event.previousContainer -the container from your item was dragged-,.... The "containers" are CdkDropList https://material.angular.io/cdk/drag-drop/api#CdkDropList, so you has the properties: id,data... – Eliseo Jun 15 '20 at 06:21
  • 1
    event.container is an object , i didn't found the target component there.. – mordechai Jun 15 '20 at 11:47

0 Answers0