Is is possible to drag'n'drop an entire Angular2 component with ng2-dragula?

259 Views Asked by At

I have a list of child components [cards] generated by *ngFor in a parent comp.[cardlist] and now I want to drag(copy) one of the children and drop it in the parents sibling [custom] component.

In addition the childs[cards] receive data from several services and @inputs, which I should display in the [custom]component after d'n'd the [cards]. I've managed to do this with simple Array with [(dragulaModule)], but I can't figure out how to manage it with components.

Is it possible to collect the [card]components classes in an array, and if it's possible how do I refer to the variables of the d'n'd-ed classes?

1

There are 1 best solutions below

0
On

Not sure is this what you're looking for, but definitely you may have items generated with *ngFor inside dragula bag.

<div
  class="row"
  dragula="'bag-items'" 
  [(dragulaModel)]="items">
  <app-list-item
    id={{item?.id}}
    *ngFor="let item of store?.items | async"
    [item]="item"
    [editMode]="store?.editMode | async"
    (tileClick)="onTileClick($event)">
  </app-list-item>
</div>