[bug report] dropModel not updating correctly, only from second drop on
REQUIRED: Before filing a bug report
- [x] My issue title starts with
[bug report] - [x] I have read the README, especially the 'classic blunders' section, and the dragula docs.
- [x] I have searched through the
ng2-dragulaissues for related problems, including closed issues. - [x] I have browsed through the issues labeled "future reference" for problems that have been solved before or have a known workaround.
- [x] I am using the latest version of
ng2-dragula.
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)
fyi: for some reason, stackblitz says copy is not a known property of dragulaOptions, but it works anyway..
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.