Closed piernik closed 9 years ago
Hi,
I'm not so sure this is an issue : I myself use this feature as such, so that I can backup the current data my user is working on in a step by step wizard, and enable him to keep the current modifications active between states for the current work session.
If my user does not press 'save' and quit the app or reload the page, the data is reloaded from the server, which is the desired behavior. If however he wants to 'submit'/'save' the changes, then the data is pushed back to the server. If he presses 'clear', the data is reset to defaults.
If this behavior was to be changed, then I would not have automatic synchronization of current modifications of the shared data between states, and I would have to code the synchronization manually.
For your use case, as far as I understand, the main problem is that you don't want to enable your user to keep the modifications he made on a form (only for the current working session) if he didn't submitted : then you just have to keep your form data separate from the injected resolved itemsDetails, and on a submit() call you juste push back the modifications made in your formData to the itemsDetails.
Thanks for response.
So You suggest to work (form stage) on angular.copy
data and after submiting data You should reload data from server?
I've got states like this - details->edit
When entering
app.companies.details
app gets data with resolve toitemDetails
local - I can inject it and use with$scope
. Then when enteringapp.companies.details.edit
app has alreadyitemDetails
from parent view - it's not loading it. I'm using those details to edit form -$scope.data=itemDetails;
.If user changes form (eg. name) but not submitting it and returns to
app.companies.details
(using breadcrumbs) theitemDetails
remembers change (and should not) so I have to use$scope.data=angular.copy(itemDetails);
But when user is submitting form, app returns to
app.companies.details
but I have old data (since I usedangular.copy
). How to update resolved data? UsingitemDetails=$scope.data;
after submitting is not working.