Giter Site home page Giter Site logo

ng2-dragula's Introduction

Official Angular wrapper for dragula.

npm version npm downloads Build Status codecov

Logo

Drag and drop so simple it hurts

Demo

Try out the demo!

Demo

Dependencies

Latest version available for each version of Angular

ng2-dragula Angular
2.1.1 <= 9.x
current 16.x.x

Install

You can get it on npm.

npm install ng2-dragula
# or
yarn add ng2-dragula

Setup

1. Important: add the following line to your polyfills.ts:

(window as any).global = window;

This is a temporary workaround for #849, while upstream dragula still relies on global.

2. Add DragulaModule.forRoot() to your application module.

import { DragulaModule } from 'ng2-dragula';
@NgModule({
  imports: [
    ...,
    DragulaModule.forRoot()
  ],
})
export class AppModule { }

On any child modules (like lazy loaded route modules), just use DragulaModule.

3. Add the CSS to your project

You'll also need to add Dragula's CSS stylesheet dragula.css to your application (e.g. in styles.scss). The following is slightly better than node_modules/dragula/dist/dragula.css (it includes pointer-events: none (#508) and this fix), but you may wish to make your own modifications.

/* in-flight clone */
.gu-mirror {
  position: fixed !important;
  margin: 0 !important;
  z-index: 9999 !important;
  opacity: 0.8;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
  filter: alpha(opacity=80);
  pointer-events: none;
}
/* high-performance display:none; helper */
.gu-hide {
  left: -9999px !important;
}
/* added to mirrorContainer (default = body) while dragging */
.gu-unselectable {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}
/* added to the source element while its mirror is dragged */
.gu-transit {
  opacity: 0.2;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
  filter: alpha(opacity=20);
}

Then you're ready to go

Here's a super quick sample to get you started:

@Component({
  selector: "sample",
  template:`
  <div>
    <div class="wrapper">
      <div class="container" dragula="DRAGULA_FACTS">
        <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="DRAGULA_FACTS">
        <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 {}

Usage

This package isn't very different from dragula itself. I'll mark the differences here, but please refer to the documentation for dragula if you need to learn more about dragula itself.

Directive

There's a dragula directive that makes a container's direct children draggable. You must supply a string. Both syntaxes, dragula="VAMPIRES" or [dragula]="'VAMPIRES'", work equally well.

<ul dragula="VAMPIRES">
  <li>Dracula</li>
  <li>Kurz</li>
  <li>Vladislav</li>
  <li>Deacon</li>
</ul>

Grouping containers

You can group containers together by giving them the same group name. When you do, the children of each container can be dragged to any container in the same group.

<div dragula="VAMPIRES">
  <!-- vamps in here -->
</div>
<div dragula="VAMPIRES">
  <!-- vamps in here -->
</div>

<div dragula="ZOMBIES">
  <!-- but zombies in here! -->
</div>

If you want to make sure you are using the same type string in different places, use the [dragula] syntax to pass a string variable from your component:

<div [dragula]="Vampires"></div>
<div [dragula]="Vampires"></div>
class MyComponent {
  Vampires = "VAMPIRES";
}

Saving changes to arrays with [(dragulaModel)]

If your container's children are rendered using ngFor, you may wish to read what your users have done. If you provide the same array to the [(dragulaModel)] attribute on the container element, any changes will be synced back to the array.

NOTE: v2 changes the behaviour of [dragulaModel]. It no longer mutates the arrays you give it, but will shallow clone them and give you the results. Use two-way binding with [(dragulaModel)]="...", or use the DragulaService dropModel and removeModel events to save the new models produced.

<ul dragula="VAMPIRES" [(dragulaModel)]="vampires">
  <li *ngFor="let vamp of vampires">
    {{ vamp.name }} likes {{ vamp.favouriteColor }}
  </li>
</ul>

You do not, of course, have to sync the changes back. The [(dragulaModel)] syntax is equivalent to:

<ul dragula="VAMPIRES" [dragulaModel]="vampires" (dragulaModelChange)="vampires = $event">
  ...
</ul>

Note: DO NOT put any other elements inside the container. The library relies on having the index of a DOM element inside a container mapping directly to their associated items in the array. Everything will be messed up if you do this.

On top of the normal Dragula events, when [(dragulaModel)] is provided, there are two extra events: dropModel and removeModel. Further details are available under Events

Drake options

If you need to configure the drake (there's exactly one drake per group), you can use the DragulaService.

import { DragulaService } from 'ng2-dragula';

class ConfigExample {
  constructor(private dragulaService: DragulaService) {
    dragulaService.createGroup("VAMPIRES", {
      removeOnSpill: true
    });
  }
}

See below for more info on options.

DragulaService

This service exposes a few different methods with which you can interact with dragula.

dragulaService.createGroup(name, options)

NOTE: formerly known as setOptions()

Creates a group named name, with an options object.

dragulaService.find(name: string)

Returns a Group named name, if there is one. A Group contains the following properties.

  • name is the name that identifies the group
  • drake is the raw drake instance itself
  • options is the options object used to create the drake. Modifying it won't do anything useful.

dragulaService.destroy(name)

Destroys a Group named name and its associated drake instance. Silently returns if the group does not exist.

DragulaOptions

Refer to the documentation for dragula to learn more about the native options.

All of the native options work with ng2-dragula. However, there is one addition:

copyItem: <T>(item: T) => T

When you have:

  • [(dragulaModel)]
  • copy is true or a function that returns true

... ng2-dragula will have to create a clone of the JS object you picked up. In previous versions of ng2-dragula, there was a terribly buggy, one-size-fits-all clone function. From v2 onwards, you MUST provide your own copyItem function.

If you have a simple object with no nested values, it could be as simple as:

{
  copy: ...,
  copyItem: (item: MyType) => ({ ...item })
}

There is a complete example using a Person class on the demo page.

Events

Whenever a drake instance is created with the dragula directive, there are several events you can subscribe to via DragulaService. Each event emits a typed object, which you can use to get information about what happened.

Refer to the Drake events documentation for more information about the different events available. Each event follows this format:

Event named: 'drag'

Native dragula:
  Use: drake.on('drag', listener)
  Listener arguments: (el, source)

ng2-dragula:
  Method: DragulaService.drag(groupName?: string): Observable<...>
  Observable of: { name: string; el: Element; source: Element; }

Each supports an optional parameter, groupName?: string, which filters events to the group you're interested in. This is usually better than getting all groups in one observable.

The sample below illustrates how you can use destructuring to pull values from the event, and unsubscribe when your component is destroyed.

<div dragula="VAMPIRES"></div>
import { Subscription } from 'rxjs';
import { DragulaService } from 'ng2-dragula';

export class MyComponent {
  // RxJS Subscription is an excellent API for managing many unsubscribe calls.
  // See note below about unsubscribing.
  subs = new Subscription();

  constructor(private dragulaService: DragulaService) {

    // These will get events limited to the VAMPIRES group.

    this.subs.add(this.dragulaService.drag("VAMPIRES")
      .subscribe(({ name, el, source }) => {
        // ...
      })
    );
    this.subs.add(this.dragulaService.drop("VAMPIRES")
      .subscribe(({ name, el, target, source, sibling }) => {
        // ...
      })
    );
    // some events have lots of properties, just pick the ones you need
    this.subs.add(this.dragulaService.dropModel("VAMPIRES")
      // WHOA
      // .subscribe(({ name, el, target, source, sibling, sourceModel, targetModel, item }) => {
      .subscribe(({ sourceModel, targetModel, item }) => {
        // ...
      })
    );

    // You can also get all events, not limited to a particular group
    this.subs.add(this.dragulaService.drop()
      .subscribe(({ name, el, target, source, sibling }) => {
        // ...
      })
    );
  }

  ngOnDestroy() {
    // destroy all the subscriptions at once
    this.subs.unsubscribe();
  }
}

NOTE: You should always unsubscribe each time you listen to an event. This is especially true for a component, which should tear itself down completely in ngOnDestroy, including any subscriptions. It might not be necessary if you have a global singleton service (which is never destroyed) doing the subscribing.

You can also engineer your use of events to avoid subscribing in the first place:

import { merge } from 'rxjs';
import { mapTo, startWith } from 'rxjs/operators';

dragStart$ = this.dragulaService.drag("VAMPIRES").pipe(mapTo(true));
dragEnd$ = this.dragulaService.dragend("VAMPIRES").pipe(mapTo(false));
isDragging$ = merge(dragStart$, dragEnd$).pipe(startWith(false));

// html: [class.dragging]="isDragging$ | async"

Special Events for ng2-dragula

The dropModel(name?: string) and removeModel(name?: string) events are only active when you have supplied [dragulaModel].

Event Name Listener Arguments Event Description
dropModel { type, el, target, source, item, sourceModel, targetModel, sourceIndex, targetIndex } same as normal drop, but with updated models + the item that was dropped
removeModel { type, el, container, source, item, sourceModel, sourceIndex } same as normal remove, but with updated model + the item that got removed

Classic Blunders

There are a number of very common issues filed against this repo. You will be mocked terribly if you file a bug and it turns out you made one of these blunders and it wasn't a bug at all.

1. Do not put [dragula] or [(dragulaModel)] on the same element as *ngFor.

WRONG:

<div class="container">
  <div *ngFor="let x of list"
       dragula="WRONG" [(dragulaModel)]="list">...</div>
</div>

RIGHT:

<div class="container" dragula="RIGHT" [(dragulaModel)]="list">
  <div *ngFor="let x of list">...</div>
</div>

2. Do not add any child elements that aren't meant to be draggable

WRONG:

<div class="container" dragula="WRONG" [(dragulaModel)]="list">
  <h2>WRONG: This header will mess up everything, and you will
      get really weird bugs on drop</h2>
  <div *ngFor="let x of list">...</div>
</div>

RIGHT:

<h2>This header will not be draggable or affect drags at all.</h2>
<div class="container" dragula="RIGHT" [(dragulaModel)]="list">
  <div *ngFor="let x of list">...</div>
</div>

Alternatives

There are hundreds of other libraries that do this. Some notable ones:

Development

  • You must use Yarn >= 1.3. It includes the 'workspaces' feature.
  • Please use Conventional Commits in your commit messages.

setup

yarn
yarn workspace ng2-dragula build

run tests

yarn workspace ng2-dragula test
# or
yarn workspace ng2-dragula test:headless

run demo server

# listens for changes in the library and rebuilds on save
yarn watch
# runs demo server
yarn workspace demo start

Publishing a new version

yarn lerna publish

Credits

  • v1: Nathan Walker (@NathanWalker)
  • v1.x: Dmitriy Shekhovtsov (@valorkin)
  • v2: Cormac Relf (@cormacrelf)

ng2-dragula's People

Contributors

abdel-ships-it avatar blackbaud-brandonstirnaman avatar cormacrelf avatar danizep avatar ggirou avatar gilhanan avatar gkalpak avatar gnujeremie avatar greenkeeperio-bot avatar hilltravis avatar hongbo-miao avatar iblank avatar joeskeen avatar josephskh avatar josh1billion avatar jziggas avatar lewiswebber avatar lzoubek avatar mikebeaton avatar nathanwalker avatar otelnov avatar reda-alaoui avatar ronnievdv avatar sorb999 avatar svetlanamuravlova avatar tamascsaba avatar thanatos-elnyx avatar trik avatar valorkin avatar xtiancapil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng2-dragula's Issues

feat(build): add system.js bundles

I am quite new NodeJS and Angular developer.

My ultimate goal is to have only one ng2-dragula.js file on the web page to avoid several separate requests for dragula.directive.js, dragula.provider.js, dragula.js and ng2-dragula.js.
Below you can see that there are separate requests for this:
image

My component has the line below:
import {Dragula, DragulaService} from 'ng2-dragula/ng2-dragula';

My tsconfig.json is below:
{ "compilerOptions": { "target": "ES6", "module": "commonjs", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false } }

So, what I am trying to do.
Way 1:
I tried to change System config the way below:
System.config({ defaultJSExtensions: true, packages: { angular2: { defaultExtension: false }, rxjs: { defaultExtension: false } }, paths: { 'dragula': 'node_modules/dragula/dist/dragula.js', 'ng2-dragula/*': 'node_modules/ng2-dragula/bundles/ng2-dragula.js', } });

But it doesn't work, but I guess it should not, but not sure.

Way 2:
I tried to do it manually and added to my html page:
<script src="node_modules/ng2-dragula/bundles/ng2-dragula.js"></script>

But in this case 2 requests go as you can see below:
image
The first one is from script tag I added manually, but the second request seems is generated by import operator from my component and gives error.

SyntaxError: Unexpected token <

Just installed ng2-dragula in a bare bones application and getting this error.

dragula.component.ts:

import {Component} from 'angular2/core';
import {DragulaService, Dragula} from 'ng2-dragula/ng2-dragula';

@Component({
  selector: 'sample',
  directives: [Dragula],
  viewProviders: [DragulaService],
  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>
  `
})
export class Sample {}

index.html:

<html>
  <head>
    <base href="/" />
    <title>Angular 2 QuickStart</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">    
    <link rel="stylesheet" href="styles.css">

    <!-- 1. Load libraries -->
    <!-- IE required polyfills, in this exact order -->
    <script src="node_modules/es6-shim/es6-shim.min.js"></script>
    <script src="node_modules/systemjs/dist/system-polyfills.js"></script>
    <script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>   

    <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>
    <script src="node_modules/rxjs/bundles/Rx.js"></script>
    <script src="node_modules/angular2/bundles/angular2.dev.js"></script>
    <script src="node_modules/angular2/bundles/http.dev.js"></script>
    <script src="node_modules/angular2/bundles/router.dev.js"></script>

    <!-- 2. Configure SystemJS -->
    <script>
      System.config({
        packages: {        
          app: {
            format: 'register',
            defaultExtension: 'js'
          }
        }
      });
      System.import('app/main')
            .then(null, console.error.bind(console));
    </script>
  </head>

  <!-- 3. Display the application -->
  <body>
    <sample>Loading...</my-app>
  </body>
</html>

main.ts:

import { bootstrap } from 'angular2/platform/browser';
import { ROUTER_PROVIDERS } from 'angular2/router';
import {Sample} from './components/dragula.component';

bootstrap(Sample, [ROUTER_PROVIDERS]);

But if I remove the following lines then the app runs at least:

  directives: [Dragula],
  viewProviders: [DragulaService]

Second container won't update

Hello, so i'm trying to use an example from the demo page. The example have title "Angular-specific example. Fancy some ngFor?". So into dragula.providers.ts i changed line 75
from:
drake.on('remove',function removeModel (el, source) { //bla bla bla }))
to:
drake.on('remove', (el, source) => { //bla bla bla}))
Cause it was complaining about removeModel that doesn't have an emit function on line 83.

Now my class look like this:
export class Page1 {
public many: Array = [{name: 'buton', type:'button'},{name:'container', type:'text'}];
public many2: Array = [{name: 'alt buton', type:'button'},{name:'alt container', type:'text'}];
constructor(private dragulaService: DragulaService) {
dragulaService.setOptions('first-bag', {
removeOnSpill: true,
copy: function(el, source){
return source.className.indexOf('can_move') != -1;
},
accepts: function (el, source) {
return source.className.indexOf('can_move') === -1;
// return el.className === 'can-copy';
}
});
dragulaService.dropModel.subscribe((value) => {
this.onDropModel(value.slice(1));
});
dragulaService.removeModel.subscribe((value) => {
this.onRemoveModel(value.slice(1));
});
}
private onDropModel(args) {
let [el, target, source] = args;
window.console.log('This is interesting fact', this.many2); // This is the line that give me a headache
}

private onRemoveModel(args) {
let [el, source] = args;
}
}

And the Html looks like this:

<xmp> <div class='wrapper'> </xmp><br />
  <xmp> <div class='container can_move' [dragula]='"first-bag"' [dragulaModel]='many'> </xmp><br />
    <xmp> <container1 *ngFor="#item of many" [type]="item.type" name="item.name"></container1> </xmp><br />
<xmp>   </div> </xmp><br />
 <xmp>  <div class='container container2' [dragula]='"first-bag"' [dragulaModel]='many2' style="text-align:center"> </xmp><br />
     <xmp><div *ngFor='#text of many2'> </xmp><br />
      <xmp> <button *ngIf="text.type=='button'">{{text.name}}</button> </xmp><br />
     <xmp>  <div *ngIf="text.type=='text'">{{text.name}}</div> </xmp><br />
     <xmp></div> </xmp><br />
  <xmp> </div> </xmp><br />
 <xmp></div> </xmp><br />

Ok so the problem is not a problem until i empty this.many2 and after that i try to move something from first container to second container. When i try to move one item from many1 onDropModel is called and my many2 has one object but into my Html elements it doesn't show at all...after i move some more times i get something in my second container but this.many2.length is >1 even if i have just one element showed.

I hope you understand otherwise tell me so i will explain more

Drag into recycle bin

Hello,

is it possible to have some divs (widgets) which you can drag into an other div which is my recycle bin but blocking the drag and drop for change position of the widgets?

So for example I can drag 10 divs into 1 div, but the 10 divs can change position on there container.

I hope I explained it good enough.

thx
Michael

Instructions for Angular-CLI project?

Can someone please add instructions for getting ng2-dragula working in an Angular-CLI app?

I've tried multiple times and cannot get it working. I posted an issue here about this previously but it was closed prematurely.

Add a demo example file

Hi,
First of all, thank you for this amazing wrapper !

I'd like to know if it's plan to add some demo files following the latest angular quickstart ?
It might be very useful.

Thanks

Failed to import with JSPM package manager

I was trying to inject ng2-dragula to Angular2 project ruled with JSPM package manager. But when I import it main boot.js file fails to compile... I've attached a part of my jspm.conf.js if it helps.

System.config({
  defaultJSExtensions: true,
  transpiler: false,
  paths: {
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },

  map: {
    "angular2": "npm:[email protected]",
    "babel": "npm:[email protected]",
    "babel-runtime": "npm:[email protected]",
    "dragula": "npm:[email protected]",
    "jquery": "npm:[email protected]",
    "ng2-dragula": "npm:[email protected]",
    "normalize.css": "github:necolas/[email protected]",
    "rxjs": "npm:[email protected]",
    "github:jspm/[email protected]": {
      "assert": "npm:[email protected]"
    },
    "github:jspm/[email protected]": {
      "buffer": "npm:[email protected]"
    },
...

Cannot install [email protected]

I got this error message while trying to install version 1.1.7

npm ERR! [email protected] postinstall: `npm run webdriver-update && typings install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'npm run webdriver-update && typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ng2-dragula package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run webdriver-update && typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ng2-dragula
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ng2-dragula
npm ERR! There is likely additional logging output above.

My npm version:

{ npm: '3.8.6',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '56.1',
  modules: '48',
  node: '6.1.0',
  openssl: '1.0.2h',
  uv: '1.9.0',
  v8: '5.0.71.35',
  zlib: '1.2.8' }

"Drag animation" not working

Copied the same code and CSS as the demo app, but the "drag animation" while dragging the object is not working properly.

The drag object appears in the bottom of my page:

image

When I leave my mouse, the object (at the bottom) dissapears.

What's wrong?

Cross container drag&drop

Hi,

It seems to be impossible with this version to drag from a first container an item to a second container.

  <ul [dragula]='"bag1"' >
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
  </ul>
  <ul [dragula]='"bag2"' >
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
  </ul>

Angular2 RC compatibility

Hello Valor software team!

With the release of angular 2.0.0-rc.0, some changes needs to happen for ng2-dragula integration in angular apps.

It should be limited to dependency update and import namespace modifications like 'angular2/core' -> '@angular/core'

I've started to work on it but I'll have very little time to finish this so I prefer to open this issue :)

Thanks for your nice work !

Remove .ts files from node package

Hi,

you need to remove the .ts files from the node package. This means you are left with the Javascript files (.js) and the definition files (.d.ts). This is sufficient. Having the .ts files in the packages causes the typescript compiler to try to compile it, which causes a lot of trouble and is unnecessary.

In particular these files are: ng2-dragula.ts, src\app\directives\dragula.directive.ts and src\app\providers\dragula.provider.ts.

Best regards

Example app fails with "TypeError: Cannot read property 'replace' of undefined"

Hi,

When I do a fresh checkout of ng2-dragula and try npm start, I get the following error:

> webpack-dev-server --inline --progress --port 3000

 70% 1/1 build modules/Users/tech/code/ng2-dragula/node_modules/webpack/lib/NormalModuleFactory.js:72
            var elements = request.replace(/^-?!+/, "").replace(/!!+/g, "!").split("!");
                                  ^

TypeError: Cannot read property 'replace' of undefined
    at /Users/tech/code/ng2-dragula/node_modules/webpack/lib/NormalModuleFactory.js:72:26
    at /Users/tech/code/ng2-dragula/node_modules/webpack/lib/NormalModuleFactory.js:28:4
    at /Users/tech/code/ng2-dragula/node_modules/webpack/lib/NormalModuleFactory.js:159:3
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/Users/tech/code/ng2-dragula/node_modules/tapable/lib/Tapable.js:75:69)
    at NormalModuleFactory.create (/Users/tech/code/ng2-dragula/node_modules/webpack/lib/NormalModuleFactory.js:144:8)
    at /Users/tech/code/ng2-dragula/node_modules/webpack/lib/Compilation.js:214:11
    at /Users/tech/code/ng2-dragula/node_modules/async/lib/async.js:181:20
    at Object.async.forEachOf.async.eachOf (/Users/tech/code/ng2-dragula/node_modules/async/lib/async.js:233:13)
    at Object.async.forEach.async.each (/Users/tech/code/ng2-dragula/node_modules/async/lib/async.js:209:22)
    at Compilation.addModuleDependencies (/Users/tech/code/ng2-dragula/node_modules/webpack/lib/Compilation.js:185:8)

I have attached the CLI output of the git clone, npm install, and npm start. I have also attached the file npm-debug.log. Thanks!

cli-out.txt
npm-debug.log.txt

Every error stacktrace line refers to dragula.provider.ts:131

hello,
I use angular 2 + typescript and when I add a throw('abc') on a page which has nothing to do with dragula, my stacktrace looks like this:

EXCEPTION: Error: Uncaught (in promise): xyz
dragula.provider.ts:131 EXCEPTION: Error: Uncaught (in promise): xyzBrowserDomAdapter.logError @ 
dragula.provider.ts:131BrowserDomAdapter.logGroup @ dragula.provider.ts:131ExceptionHandler.call @ 
dragula.provider.ts:131(anonymous function) @ dragula.provider.ts:131schedulerFn @ 
dragula.provider.ts:131SafeSubscriber.__tryOrUnsub @ dragula.provider.ts:131SafeSubscriber.next @ 
dragula.provider.ts:131Subscriber._next @ dragula.provider.ts:131Subscriber.next @ 
dragula.provider.ts:131Subject._finalNext @ dragula.provider.ts:131Subject._next @ 
dragula.provider.ts:131Subject.next @ dragula.provider.ts:131EventEmitter.emit @ 
dragula.provider.ts:131NgZone._zoneImpl.ng_zone_impl_1.NgZoneImpl.onError @ 
dragula.provider.ts:131NgZoneImpl.inner.inner.fork.onHandleError @ 
dragula.provider.ts:131ZoneDelegate.handleError @ dragula.provider.ts:131Zone.runGuarded @ 
dragula.provider.ts:131_loop_1 @ dragula.provider.ts:131drainMicroTaskQueue @ 
dragula.provider.ts:131ZoneTask.invoke @ dragula.provider.ts:131

The code lines in stracktrace are obviously from Angular 2 codebase, but each line has reference source file+codeline set to dragula.provider.ts:131.

Here is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowUnreachableCode": true,
    "sourceMap": true
  },
  "filesGlob": [
    "**/*.ts",
    "!node_modules/**/*"
  ],
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

the stacktrace looks the same no matter if sourceMap in tsconfig.json is set to true or false.

I run the whole app in ionic 2 so that webpack takes cares of the final bundle js.
My environment:
32bit ubuntu 14.04, node v0.12.7, npm 2.11.3, angular 2.0.0-beta.15, ng2-dragula 1.1.6, typescript "1.8.7

Issue with dragulaModel

Hey! thanks for the free Angular2 plugin. I face a weird problem when I use dragulaModel. Please correct me if my understanding is wrong.

Issue: If I add dragulaModel to keep track of changes in the UI, the item I move disappears.

Here is the document with screenshots, explaining the problem:
ng2-dragula-dragulaModel-table.docx

Configuring ng2-dragula for system.js seed

I fail to figure out how to configure ng2-dragula with the system.js seed https://github.com/mgechev/angular2-seed
I understand there is a similar ticket but clearly describing the solution for this widespread seed would be nice I think.

Versions used:
npm 3.3.12
node v5.1.0
MacOS 10.11.1
Chrome 48
Visual Studio Code Editor

Steps
npm install [email protected] [email protected] --save
Then, in a component, when I do
import { Dragula, DragulaService} from 'ng2-dragula/ng2-dragula';
Note the full import path above. Is this correct or incorrect?

I get a runtime error where the browser tries to load dragula.js from
http://localhost:5555/node_modules/dragula.js
where obviously, the directory name is missing.

Questions

  • How do I configure the seed to load the file from the correct directory?
  • Certainly I should configure the seed somehow to know where to find the actual ng2-dragula, i.e. somehow refer to directory nodes_modules/ng2-dragula/bundles
    I tried such configs in the seed's config.ts file's section DEV_NPM_DEPENDENCIES but didn't find a solution

OnDrop not working?

I am dragging and dropping one component on the following [row-bag].component is getting drag-dropped successfully.

<li *ngFor="#secRowColumn of sectionRow.secRowColumns;#secRowColumnIndex=index" 
    [dragula]='"row-bag"' (ondrop)="print(secRowColumnIndex)" 
    class="col-md-{{12/sectionRow.secRowColumns.length}}"
    style="margin:0 auto;border:1px solid gray;"       
    [ngClass]="secRowColumn.cssClass" 
    >
        "{{secRowColumn.colName}}" 
</li>

the *ngFor loop renders columns on page and I am trying to drop components in one of these columns, what I want is when I drop a component in 2nd column I want to access its index i.e. secRowColumnIndex.

I tried event binding as (ondrop)="print(secRowColumnIndex)" but could not get any success.
also I tried printing args of ondrop method as follow:

dragulaService.drop.subscribe((value: any[]) => {
        console.log(`drop: ${value[0]}`);
        this.onDrop(value.slice(1));
        console.log(value);//secRowColumnIndex is not received here too.
    });

doing above does not print the secRowColumnIndex.any inputs about how can I access secRowColumnIndex?

Dragging ng2 components

Hi,

Do you have an example how to implement dragging on a simple ng2 component. The demo website just uses strings.

I was using the 'RepeatExample' section and replaced the string with the component object:
many: Array = [new TestComponent];
All I get there is the text '[object Object]' and not the actual visual component.

I realize that I might be mis-understanding this completely so any help would be appreciated.

chore(deps): Duplicate identifier errors on angular2-webpack-starter app

If I import ng2-dragula:
import {DragulaService} from "ng2-dragula/ng2-dragula";
import {Dragula} from "ng2-dragula/ng2-dragula";
TS compiler complains a dozen of such errors on my stater app
ERROR in /ui/node_modules/ng2-dragula/node_modules/angular2/typings/node/node.d.ts
(44,5): error TS2300: Duplicate identifier 'cache'.

'dragula' is required. Any insights would be much appreciated.

Using with Angular-CLI?

How do you get this to work with Angular-CLI? After npm installing and importing both dependencies via import, I am getting the following error:

Build error

[DiffingTSCompiler]: Typescript found the following errors:
node_modules/ng2-dragula/src/app/directives/dragula.directive.ts (10, 15): Cannot find name 'require'.
node_modules/ng2-dragula/src/app/providers/dragula.provider.ts (1, 15): Cannot find name 'require'.

Support encapsulation: ViewEncapsulation.Native (Shadow DOM)

I don't know whether that's really possible, or if there is a link with this issue to support iframes (my knowledge around Shadow DOM are limited), but when I apply the native View encapsulation (wraps the component in a Shadow root), not only the project styles are not applied, but also the Dragula directive seems to have no effect: elements cannot be dragged and the dropzone is not active to drop something coming from another area (outside Shadow root) of same bag name. But Angular 2 components/directives are still working, since I have components dynamically loaded inside the shadow DOM.

Any idea about this and what could be supported?

I believe Shadow DOM could be a good alternative to iframes for a dropzone with a different set of styles applied.

Thanks!

Having a difficult time figuring out how to include ng2-dragula with System.js

So I've bootstrapped an angular2 project and I'm trying to use ng2-dragula.

Here's what my System.config looks like (in terms of ng2-dragula)

paths: {
  'ng2-dragula': './node_modules/ng2-dragula/ng2-dragula.js'
}

And my index.html importing ng2-dragula:

<script src="node_modules/ng2-dragula/ng2-dragula.js"></script>

Everything seems to load fine after this and I'm not getting 404's on finding the ng2-dragula module. However, after I actually try importing the Dragula directive and DragulaService provider, I get these errors:

[1] GET /ng2-dragula/src/directives/dragula.directive 404 0.708 ms - 57
[1] File change detected /Users/bsmith/Development/git/sample.com/sample-ui/app/work-board/work-board.component.ts
[1] GET /ng2-dragula/src/directives/dragula.directive 404 0.967 ms - 57

My component code just follows the FAQ:

import { Dragula, DragulaService } from 'ng2-dragula';
@Component({
  directives: [Dragula],
  viewProviders: [DragulaService]
})

Any help on troubleshooting this would be greatly appreciated.

Issue with dragulaModel : modifying an item when dropping

Hey! thanks for the Angular2 plugin.
I face a problem when I try to override the way items are dropping between to bags in which data have different structures.

<div [dragula]='"slides-bag"' [(dragulaModel)]='slides'>
    <div class="slide" *ngFor="#s of slides; #idx=index">
        <div class="slidefields" [dragula]='"fields-bag"' [dragulaModel]='s.items'>
            <div class="field" *ngFor="#f of s.items; #idxs=index">
                ...
            </div>
        </div>
    </div>
</div>

<div [dragula]="'fields-bag'" [dragulaModel]='mobileFields'>
    <div class="mobilefield" *ngFor="#m of mobileFields">
</div>

When I drag an element from 'mobileFields' and drop it in 'slidesfields', I want to transform the mobilefield into slidefield.
For the moment, the only solution I founded is the following :

  • when the dropModel event is raised, finding the element that was inserted (what is not so easy because the dropModel event doesn't return the object that was inserted, only the html element)
  • and then modify its attributes

Is there a better way to de that ? The best for me would be to acted before the models are updated.

Thanks in advance !

dragula is not a function

Hello guys,

I'm trying to insert ng2-dragula in my project but many problems appears.

So, I successfully import ng2-dragula by run :

npm install dragula ng2-dragula --save

I added in my index.html the original dragula lib :

<script src="node_modules/dragula/dist/dragula.min.js"></script>

And setup it in System.config :

System.config({
      packages: {
        app: {
          format: 'register',
          defaultExtension: 'js'
        },
        'dragula': {
          defaultExtension: 'js'
        },
        'ng2-dragula': {
          defaultExtension: 'js'
        }
    },
    map: {
        "dragula": 'node_modules/dragula/dist/dragula.js',
        'ng2-dragula' : 'node_modules/ng2-dragula',
    }
});

After this, I added in my component the directive and the service in directives and viewProviders array. (Like the README recommand).

At first, I've got the following error :

dragula is not a function in [....

After research, when we comment this line (in dragular.directives.ts) :

import * as dragula from 'dragula';

All work as expected, but if I keep it, I got the following :

dragula is not a function in

I don't use Webpack, did you got a idea for this problem ?

Typo/inconsistency in README vs. demo using [dragulaModel]

Does [dragula] and [dragulaModel] belong on the container or the ngFor repeated element?

README:

<ul>
  <li ngFor="#item of items" [dragula]='"bag-one"' [dragulaModel]='items'></li>
</ul>

DEMO:

 <div class='container' [dragula]='"another-bag"' [dragulaModel]='many'>
    <div *ngFor='#text of many' [innerHtml]='text'></div>
 </div>

EXCEPTION: TypeError: dragula is not a function

hiho, sry but i have to use this channel to get some basic ng2 support. this is my first ng2 project and i'm not sure how to handle ng2 in the right way...

i'm just using an apache to provide my website and this are my scripts:

index.html

</html>
    <head>
        <script src="/ng2app/listFlow/node_modules/dragula/dist/dragula.js"></script>


        <!-- 1. Load libraries -->
        <!-- IE required polyfills, in this exact order -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.20/system-polyfills.js"></script>
        <script src="https://npmcdn.com/[email protected]/es6/dev/src/testing/shims_for_IE.js"></script>

        <script src="https://code.angularjs.org/2.0.0-beta.14/angular2-polyfills.js"></script>
        <script src="https://code.angularjs.org/tools/system.js"></script>
        <script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script>
        <script src="https://code.angularjs.org/2.0.0-beta.14/Rx.js"></script>
        <script src="https://code.angularjs.org/2.0.0-beta.14/angular2.dev.js"></script>

        <!-- 2. Configure SystemJS -->
        <script>
            System.config({
                transpiler: 'typescript',
                typescriptOptions: {
                    emitDecoratorMetadata: true
                },
                packages: {
                    'app': {
                        defaultExtension: 'ts'
                    }
                },
                map: {
                    'dragula': '/ng2app/listFlow/node_modules/dragula/dist/dragula.js',
                    'crossvent': '/ng2app/listFlow/node_modules/crossvent/dist/crossvent.min.js',
                    'contra/emitter': '/ng2app/listFlow/node_modules/contra/emitter.js',
                    'ticky': '/ng2app/listFlow/node_modules/ticky/ticky-browser.js',
                    'atoa': '/ng2app/listFlow/node_modules/atoa/atoa.js',
                }
            });
        </script>

        <script>
            System.import( '/ng2app/listFlow/main.ts' )
                    .then(null, console.error.bind(console));
        </script>

    </head>
    <body>
        <list-flow>Loading...</list-flow>
    </body>
</html>

main.ts

import {bootstrap}  from 'angular2/platform/browser';
import {ListFlow} from './Component/ListFlow';
bootstrap(ListFlow);

ListFlow.ts

import {Component} from 'angular2/core';
import {DragulaService, Dragula} from "../ng2-dragula/ng2-dragula"; // a direct clone from git repo

@Component({
    selector: 'list-flow',
    directives: [Dragula],
    viewProviders: [DragulaService],
    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>
  `,
})
export class ListFlow {

}

as you can see, i have refer to NPM packages and also a direct clone to ng2-dragula repositor. i have also test with ng2-dragula from NPM repo, but the same error:

EXCEPTION: TypeError: dragula is not a function in ["first-bag" in ListFlow@3:35]

plz help me to get this simple demo running :)

Typescript compilation fails with module: system instead of commonjs

The files dragula.directive.ts and dragula.provider.ts import the dragula library with a require instead of an import:

var dragula = require('dragula');

This is tolerated if typescript compiles in commonjs, because the output is based on require, but it is not when compiling in system format. For multiple reasons, my project is compiled in the system format ("module": "system").

-> Workaround I applied on my project:

  • Replace var dragula = require('dragula'); by import dragula from 'dragula';
  • add the dragula typings to the project, and modify it to add the default export (to avoid errors):
declare module "dragula" {
    export = dragula;
    export default dragula;
}

But it does not look like a clean fix. I don't know how to fix it cleanly. The idea is to keep the TypeScript syntax to allow the TS compiler to deal with it in all cases.

PS: I forgot the final error: require remains in the compiled version, and is undefined in the browser.

dragulaModel does not update model array when items are identical

In a standard drag'n drop single bag where the items are indexed, i.e.

<div [dragula]='"bag"' [dragulaModel]="numbers">
    <div *ngFor="#n of numbers; #i = index">
            #{{i+1}} · {{n}} 
      </div>
</div>

if this is bound to an array with different items, say

numbers = [42, 43, 44, 45, 46]

Everything works fine when dragging and dropping. However, if the array contains duplicate entries, say

numbers = [1, 2, 1, 1, 1, 1] 

than dragging and dropping will not truly reorder the model, so that the index i will eventually be in random order. Admittedly it might not make much sense to put order on identical items, but the index is ruined and that is an issue.

Drag/drop between multiple Angular2 components

Hi, is it possible to drag&drop between two component instances?

I have the same problem as described here:
How to drag/drop to multiple Angular2 component using ng2-dragula
http://stackoverflow.com/questions/35981273/how-to-drag-drop-to-multiple-angular2-component-using-ng2-dragula

Quote:

I have a Angular2 component using ng2-dragula to drag/drop like this:

@component({
selector: 'my-comp',
directives: [
Dragula
],
viewProviders: [
DragulaService
],
template: <div class="my-div"> <div *ngFor="#item of items" [dragula]='"card-bag"' [dragulaModel]='items'> ... </div> </div>
})

My issue: if I create multiple "my-comp" component, item inside "card-bag" can not drag/drop across these component although they have the same bag name. These item are only able to drag/drop inside it owned component.

Do we have any configs for drag/drop across components, or this is ng2-dragula limitation?

Thanks.

How do you get access to a dropped item's model or "scope"?

How do you get access to a dropped item's model or "scope"?

The value passed to the drop event is an array of HTML elements, but the Angular 2 component variables (data) are no where to be found. For example, how can I save the individual model's information to the server after it is dragged and dropped?

ng2-dragula doesn't work with webpack

I have successfully managed to import this in to my project, and it doesn't give any compile errors, however once you browse to the page the console shows several exceptions and the page crashes.

image

It appears this stems from the fact that this component attempts to work with the window property, which is not available to the scope of packaged angular products built through things like webpack.


EXCEPTION: TypeError: window.dragula is not a function in [first-bag in Home@2:47]
vendor.bundle.js:25169 EXCEPTION: TypeError: window.dragula is not a function in [first-bag in Home@2:47]BrowserDomAdapter.logError @ vendor.bundle.js:25169
vendor.bundle.js:25169 ORIGINAL EXCEPTION: TypeError: window.dragula is not a functionBrowserDomAdapter.logError @ vendor.bundle.js:25169
vendor.bundle.js:25169 ORIGINAL STACKTRACE:BrowserDomAdapter.logError @ vendor.bundle.js:25169
vendor.bundle.js:25169 TypeError: window.dragula is not a function
at Dragula.ngOnInit (http://localhost:3000/main.bundle.js:272:44)
at

Dropping outside bag/target fails with copy: true

Hi, it seems dropping outside a bag throws an error in dragular.provider.ts#domIndexOf method because the parent parameter there is undefined once I activate the copy option on the dragulaService. I worked around it by editing the drop event handler line 91:

Before:

if (!drake.models) {
  return;
}

After:

if (!drake.models || !target) {
  return;
}

But I am not sure it is the right fix.

Thanks for this library btw, it works great for the rest.

Accessing model objects from events (this is a question, not an issue)

I apologize for posting a question, instead of an issue. If there is a more appropriate forum for these questions, please let me know.

I am using ng2-dragula for a recursive tree structure built from a data model, like this:

@Component({
  selector: '[tree-view]',
  directives: [TreeView, Dragula],
  template: `
      <div *ngFor="#node of treeData">
        <p>{{node.name}}<p>
        <div tree-view [treeData]="node.children"  dragula="tree-children" [dragulaModel]="node.children">  
      </div>
  `
})
class TreeView {
  @Input() treeData:[TreeNode];
}

This works great! However, I am trying to customize the drake options in a TreeView constructor. I would like to use custom methods for "accepts", "moves", "invalid", and all of the events triggered. These methods take parameters like el, source, target, and sibling, which are DOM nodes. Is there a way to access my actual custom model (TreeNode) from these el, source, target, and sibling parameters?

Stuck with Demo

Can you explain me how i should manga the demo to be up and working ? I'm kinda confused with your readme file :/. And thx a lot for your effort.

Kind Regards

Cannot find module 'dragula'

I've added ng-2 dragula through webpack, but during project starting I get an error
Cannot find module 'dragula'
Drag-n-drop works a bit weird (without any visual effects). Looks like dragula styles did not apply.

usage with angular2-seed (again)

I am again trying to use ng2-dragula 1.1.5 and dragula 3.6.8 with mgechev's angular 2 seed. The mappings are working fine now, and I have also added the following to project.config.ts

   let additional_deps: InjectableDependency[] = [
      {src: 'jquery/dist/jquery.min.js', inject: 'libs'},
      {src: 'toastr/package/build/toastr.min.js', inject: 'libs'},
      {src: 'dragula/dist/dragula.min.js', inject: 'libs'},
      {src: 'semantic-ui-tab/tab.min.js', inject: 'libs'}
      // {src: 'lodash/lodash.min.js', inject: 'libs'},
    ];

import is as follows:

import {Dragula, DragulaService} from 'ng2-dragula/ng2-dragula';

I do not get compile errors, all fine, but during bootstrapping the browser throws an error in ticky.js, i.e.

Error: ReferenceError: undef is not defined

Full trace in Chrome is as follows

localhost/:94 Error: ReferenceError: undef is not defined
        at Object.eval (http://localhost:5555/node_modules/ticky/ticky.js:4:44)
        at eval (http://localhost:5555/node_modules/ticky/ticky.js:12:4)
        at eval (http://localhost:5555/node_modules/ticky/ticky.js:13:3)
        at Object.eval (http://localhost:5555/node_modules/contra/debounce.js:3:13)
    Evaluating http://localhost:5555/node_modules/ticky/ticky.js
    Evaluating http://localhost:5555/node_modules/contra/debounce.js
    Evaluating http://localhost:5555/node_modules/contra/emitter.js
    Evaluating http://localhost:5555/node_modules/dragula/dragula.js
    Evaluating http://localhost:5555/node_modules/ng2-dragula/src/app/providers/dragula.provider.js
    Evaluating http://localhost:5555/node_modules/ng2-dragula/src/app/directives/dragula.directive.js
    Evaluating http://localhost:5555/node_modules/ng2-dragula/ng2-dragula.js
    Evaluating http://localhost:5555/home/components/run.component.js
    Evaluating http://localhost:5555/home/components/run-tree.component.js
    Evaluating http://localhost:5555/app/components/app.component.js
    Evaluating http://localhost:5555/main.js
    Error loading http://localhost:5555/main.js "Report this error at https://github.com/mgechev/angular2-seed/issues"

The relevant code snippet in ticky.js is

var si = typeof setImmediate === 'function', tick;
if (si) {
  tick = function (fn) { setImmediate(fn); };
} else if (typeof process !== undef && process.nextTick) {
  tick = process.nextTick;
} else {
  tick = function (fn) { setTimeout(fn, 0); };
}

module.exports = tick;

Any thoughts?

Angular2 Webpack Starter 3.0 ang ng2 beta.9

I upgrade my ng2 project to beta9 and webpack starter 3.0, on executing it I got this error

[default] /home/michi/software/workspace/tmp/x/web-client/node_modules/ng2-dragula/src/app/directives/dragula.directive.ts (10,26):
    Cannot find module 'dragula'.
[default] /home/michi/software/workspace/tmp/x/web-client/node_modules/ng2-dragula/src/app/providers/dragula.provider.ts (1,26):
    Cannot find module 'dragula'.

some ideas or hints to give me?

EXCEPTION: Unexpected directive value 'undefined' on the View of component

I added ng2-dragula to my Angular 2.0.0-beta.7 project (I used Angular's quick start version not angular2-webpack / angular2-seed) via npm install as described here: https://github.com/valor-software/ng2-dragula/wiki
I mapped "ng2-dragula/ng2-dragula": "lib/ng2-dragula.js" to my build folder and imported Dragula and DragulaService import {Dragula, DragulaService} from 'ng2-dragula/ng2-dragula';.
This works fine but does of course nothing. 😜
Adding: directives: [Dragula], viewProviders: [DragulaService] does not work. If I navigate to the component I receive the following error: EXCEPTION: Unexpected directive value 'undefined' on the View of component
That's exactly what is written in the wiki. Do I miss something? Is the wiki outdated?

One-Sided copy

Hey there,
First of all. I really love your work!

Maybe you can help me. I like to tell my bags, that only Bag A should copy to Bag B, but not Bag B to Bag A. Is this possible?

`npm test` fails with "Error: Cannot find module './webpack.config'"

Hi,

Should I be providing my own webpack.config for running the tests? When I perform a clean checkout and run npm test, I am getting the following:

tech@dyson ~/code/ng2-dragula (master●)$ npm test

> [email protected] test /Users/tech/code/ng2-dragula
> karma start

08 03 2016 09:07:45.611:ERROR [config]: Invalid config file!
  Error: Cannot find module './webpack.config'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/tech/code/ng2-dragula/karma.conf.js:2:21)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.parseConfig (/Users/tech/code/ng2-dragula/node_modules/karma/lib/config.js:277:22)
    at new Server (/Users/tech/code/ng2-dragula/node_modules/karma/lib/server.js:56:20)
    at Object.exports.run (/Users/tech/code/ng2-dragula/node_modules/karma/lib/cli.js:235:7)
    at Object.<anonymous> (/Users/tech/code/ng2-dragula/node_modules/karma/bin/karma:3:23)
    at Module._compile (module.js:413:34)
npm ERR! Test failed.  See above for more details.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.