angularangular-dragdropangulardraganddroplists

How to save order of Angular reordered list that I get from the back-end


When a user opens the page they are shown a list, which they can reorder thanks to angulars drag&drop. The problem ofcourse is that the front-end order changed but not the back-end order. What would be the best way to keep track of the order of this list? So that when the user revisits they are shown the order in which they left it


Solution

  • The best would be to add order property to whatever entity you are fetching from the backend, and update that property accordingly every time user rearranges items

    You could also update order value of all items at once eg. after clicking apply on FE - bonus apply/revert changes feature