Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dragula drag and drop one way with copy ng2

I am trying to drag and drop one way with copy with ng2 dragula This is my template.

`<div>
   <div class='wrapper'>
     <div class='container' id='no-drop' [dragula]='"first-bag"'>
       <div>Drag/drop item 1</div>
     </div>
     <div class='container' [dragula]='"first-bag"'>
       <div>Drag/drop item 2</div>
     </div>
   </div>
 </div>` 

I have set the option to copy in my component.

constructor(private dragulaService: DragulaService) {
dragulaService.setOptions('first-bag', {
  copy: true
});

But if i set moves to false, i am not able to drag at all. How can i move from left to right and not the other way.

like image 599
user4925190 Avatar asked Apr 19 '17 16:04

user4925190


1 Answers

I found the answer soon after posting!!

   constructor(private dragulaService: DragulaService) {
    dragulaService.setOptions('first-bag', {
      copy: true,
      moves: function (el, container, handle) {
        return container.id !== 'no-drop';
      }
    });
like image 172
user4925190 Avatar answered Sep 22 '22 19:09

user4925190