ng2-dragula icon indicating copy to clipboard operation
ng2-dragula copied to clipboard

[bug report] dropModel not updating correctly, only from second drop on

Open r-sw-eet opened this issue 6 years ago • 3 comments

REQUIRED: Before filing a bug report

Describe the bug (required)

I have two arrays, the one on the right is supposed to be a list of prototypes. When I drop them into the left list/div, the new object is shown, the id is incremented. So far so good. Now I want to read out the elements of the array. With dragulaService.drop the correct number of elements are shown. With dragulaService.dropModel the number of elements is only updated when I drop a second time from right to left, or if I sort (incl. drop) in the left list. I suppose that is not the expected behaviour?

To Reproduce (required)

Steps to reproduce the behavior: [stackblitz]: https://stackblitz.com/edit/angular-hdam1p (Un-)Comment the dragulaService.dropModel or the dragulaService.drop. But if you leave them both in place, the problematic behaviour shown as well.

Screenshots (optional)

Versions (required)

Please state which versions of the following packages you have installed:

  • @angular/core: [e.g. 8.2.11]
  • ng2-dragula: [e.g. 2.1.1]

Browsers affected (optional)

Additional context (optional)

r-sw-eet avatar Oct 22 '19 09:10 r-sw-eet

fyi: for some reason, stackblitz says copy is not a known property of dragulaOptions, but it works anyway..

r-sw-eet avatar Oct 22 '19 09:10 r-sw-eet

Same issue here. And I'm not even subscribing to drop.

For my situation, it's better to use [(dragulaModel)] to define the target array and execute dropModel's logic on dragend event.

sigod avatar Jan 23 '20 13:01 sigod