When there is an Angular ReactiveForm element inside a dragged element, it shows a changed value in the drag ghost. The element on its final destination shows the correct value again.
Try a minimum example on StackBlitz: When you grab the second element (O2 with value "O2") and drag it, the ghost changes its value to "O1" while being dragged.
Is it wrong to have a form element inside a draggable? If not, is it a bug? In ng2-dragula or rather in the (Reactive)FormsModule?
How could I work around this?
The problem is that selected
optionelement must haveselectedattribute present.So, you might do this:
add element reference, and also add change listener on
selectelement, and then, on change, assign selected value to a variable which will then serve to setselectedattribute viaattr.selectedin the template:Try this:
Stackblitz demo