After upgrading to v1.1.9 I started getting an error when moving items:
TypeError: Cannot read property 'splice' of undefined at applyDrop (service.js:42)
This only occurs when there are multiple instances of the directive using the same bag, but with different dragulaModel values, such as when using a nested ng-repeat.
After some investigation I found this was due to a bug in the $watch expression (introduced in v1.1.7 by #35) which was basically not checking if the model was actually in the array before calling splice; causing the last model in the array to be replaced every time. This PR checks for that and calls push instead when the model isn't found.
After upgrading to
v1.1.9
I started getting an error when moving items:TypeError: Cannot read property 'splice' of undefined
atapplyDrop
(service.js:42)This only occurs when there are multiple instances of the directive using the same bag, but with different
dragulaModel
values, such as when using a nested ng-repeat.After some investigation I found this was due to a bug in the
$watch
expression (introduced inv1.1.7
by #35) which was basically not checking if the model was actually in the array before callingsplice
; causing the last model in the array to be replaced every time. This PR checks for that and callspush
instead when the model isn't found.