1

I am using angularjs and StrongLoop generated lb-services api to update my persisted store.

I have implemented move up and move down of items in Angular by applying to the $scope array, the simple solution documented here: https://stackoverflow.com/a/23391898/2249228

But now that my $scope array has reordered elements and that my view is updated accordingly, I need to synchronize the $scope array with the db using lb-services api.

I have tried several solutions with no success. What would be a recommended approach?

Community
  • 1
  • 1
  • So your question is not really how to move up and down, but how to synchronize the new order in the db. – Hanlet Escaño Feb 01 '16 at 23:27
  • Yes indeed. I am realizing that my approach is probably wrong. What I need to do is just to add an extra 'position' field to my '$scope' items, ask angular to sort my items according to this 'position' field, and to update the position attribute in the db using StrongLoop 'updateAttributes' model instance method on the instances which are affected by the repositioning. – LionelMomméja Feb 02 '16 at 08:27

0 Answers0