I have a bunch of connected ul
lists in my view which are using a jQuery UI: Sortable directive to facilitate drag and drop and reordering of the list items.
Changes I make via jQuery UI's drag and drop I apply to the $scope
using the $apply
function, this part works…
The issue I am running into now however is that on drop into some of these lists I provide a custom form that the user needs to fill out.
The user has the option to:
$apply
call to
persists the data into the $scope
$apply
to store info, should revert the last drag/drop interaction effectively 're-rendering' all my lists to reflect the data that is still in the $scope
at this stage (since the latest drag had not had any effect on it yet).The effect of this "cancel" button is effectively reverting everything to the point before the user picked up the list item and dragged it into another list.
How can I force a 'refresh' or 're-render' of my ng-repeat
s so that they visually refresh and show the current $scope
data again?
When the user starts filling out the form, I would set
$scope.oldData = angular.copy($scope.data);
Then let the user edit $scope.data using the form as he likes.
Then if the user presses cancel, just set $scope.data = $scope.oldData
.