angularng2-dragula

How to disable drag some element on ng2-dragula


I want to display name group on the top and cancel the drag event on it. How can I disable moving some element like if this group name on the top. My code is:

dragulaService.drag.subscribe((value) => {
    console.log(`drag: ${value[0]}`);
});

My template :

<div class='wrapper'>
  <div class='container' *ngFor='let group of groups' [dragula]='"nested-bag"'>
     <div class="center-block">Table Number : {{group.name}}</div>
    <div *ngFor='let item of group.items' [innerHtml]='item.name'></div>
  </div>
</div>

Solution

  • find a solution:

      dragulaService.setOptions('nested-bag', {
          revertOnSpill: true,
          moves: function (el:any, container:any, handle:any):any {
            debugger
            console.log(el, container);
            return false;
          }
        });