Working with ng2-dragula. I'm looking to update the orderNumber for every item in a database using the new dropped order.
dragulaService.dropModel.subscribe((value) => {
var drake = dragulaService.find('bag-orders').drake
var models = drake.models
console.log(models)
})
The new model order that it returns does not reflect the order within the bag.
TL;DR: has anyone implemented reordering within a database onDrop with ng2-dragula?
I was using the ng2-dragula and It's quite strange on something that I've noticed. The issue I had was the same. Server call is not updating the data object according to the dragged order.
I've just used if clause inside the ngDoCheck lifecycle hook to solve the issue.
It's sorted in the printed object in the console. After digging deeper a bit could find out in the network that the object that is sent with the update server call was the not updated one.
So, it's because the server call is made before the data object is updated.
All I did was adding a global variable which can keep track of drag has updated the data object.
Then, in the ngDoCheck lifecycle hook,