Questions tagged [ng2-dragula]

ng2-dragula is one of the best Drag and drop library for Angular 2x and succeeding versions. its Official Angular2 wrapper for dragula( AngularJs (1.x)). This library expose lot of drag and drop call backs and events while drag and drop operations. if your using dragula than tag dragula.

Official GitHub ng2-dragula

Install

You can get it on npm.

npm install ng2-dragula --save

Setup

You'll need to add DragulaModule to your application module.

AppModule

   @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        DragulaModule,
        ...
      ],
      providers: [],
      bootstrap: [AppComponent]
    })

export class AppModule {
}
@Component({
  selector: 'sample',
  template:`
  <div>
    <div class='wrapper'>
      <div class='container' [dragula]='"first-bag"'>
        <div>You can move these elements between these two containers</div>
        <div>Moving them anywhere else isn't quite possible</div>
        <div>There's also the possibility of moving elements around in the same container, changing their position</div>
      </div>
      <div class='container' [dragula]='"first-bag"'>
        <div>This is the default use case. You only need to specify the containers you want to use</div>
        <div>More interactive use cases lie ahead</div>
        <div>Make sure to check out the <a href='https://github.com/bevacqua/dragula#readme'>documentation on GitHub!</a></div>
      </div>
    </div>
  </div>
  `
})
class Sample {}

Try out the demo!

More information about event

130 questions
4
votes
3 answers

Angular2/Ionic2 + ng2-dragula Did anyone get it to work?

Im trying to add drag and drop into my ionic 2 app. But can't get it to work. This is what I have done so far: npm install ng2-dragula dragula --save then in my page: @Component({ templateUrl: 'build/pages/dragtest/dragtest.html', directives:…
Mike Smith
  • 125
  • 8
3
votes
0 answers

ng2-dragula move item without removing it on drag start

I am using ng2-dragula in my Angular application and what I want is to be able to drag an element from the list but without the default behaviour of dragula which is removing it on drag start. I want the element to stay where it is until I drop it…
TJ 96
  • 318
  • 2
  • 8
3
votes
2 answers

ng2-dragula in angular7 failed to compile

Using a default startup Angular-Cli 7 project and following the steps as described here: https://github.com/valor-software/ng2-dragula to setup ng2-dragula, failed to compile. ng2-dragula 2.1.0 (latest). Details message: ERROR in…
Antonis
  • 43
  • 1
  • 6
3
votes
1 answer

DragulaModel not working with dynamic data

i´m using ng2-dragula and mi components var are not updating after drag and drop with it when my data is obtained by AJAX. This is my html code:
3
votes
0 answers

unable to drag drop with dragula on ios ionic2

I have implemented drag drop using dragula [ng2-dragula]. It works perfectly in browser, however when I run this app on iphone it doesn't work.
codeomnitrix
  • 4,179
  • 19
  • 66
  • 102
3
votes
1 answer

dragula - how to disable dragging in its parent container

I like how dragula works, but one thing I couldn't find solution to, is how I can disable the function of drag and drop in the same container the element is currently in. I only want to drag elements into other containers not sort them manually.
Markus
  • 65
  • 1
  • 5
3
votes
1 answer

How to leave text selectable on draggable element in Angular 2 Dragula?

I am using dragula in angular 2 application and I wonder if there is a way to leave text selectable, so like spans inside the draggable element should still behave as default, so you can highlight text on it. As far as I can say there seems not to…
Blind Despair
  • 3,190
  • 2
  • 20
  • 31
3
votes
0 answers

Angular 2, ng2-dragula, and dragulaModel

I'm trying to use ng2-dragula in my app to add the option to reorder a list of instructions that were added to a list. For example, think of it as if you were making a recipe and you put in an instruction but then wanted to move it somewhere else in…
pjlamb12
  • 2,300
  • 2
  • 32
  • 64
3
votes
1 answer

Drag and drop angular-material2 chips with ng2-dragula library

Using angular2 material and dragula, I want to drag and drop chips with ng2-dragula library. Specifying the dragula containers: Chip 1 Chip…
mrkvon
  • 3,507
  • 2
  • 21
  • 26
3
votes
1 answer

How can i make certain div elements non draggable using Dragula for Angular 2

I have been able to successfully integrate ng2-dragula with my project, but I still cannot figure out how to make some divs non draggable. I have tried to use some css and also htmls draggable="false" for the div but no success. It seems like…
Brian
  • 4,958
  • 8
  • 40
  • 56
2
votes
1 answer

ReactiveForm element show different