Note that there are some explanatory texts on larger screens.

plurals
  1. POBest way to save/update a resource with ($watch or save button, etc..)
    text
    copied!<p>Currently I run into the following problem, we are working on a form heavy application and wanted a good user experience so we tried to stop have a save / update button everywhere.</p> <p>Currently we try to <code>$watch</code> every Form Change, but this won't work correctly since it updates the scope when the model gets updated which causing problems on Decimal / Money Values.</p> <p>What would you prefer? Still the messy <code>save</code> button or maybe something like Gmail did? </p> <p>What are good methods to do this without save buttons.</p> <p><strong>/* EDITED */</strong> Currently we use this method to update our form. It first copys the scope in an object and checks if it is the same than the object that is set after the date got pulled.</p> <pre><code>$scope.$watch('task', function(scope) { console.log($scope.updateForm); scopeObject = angular.copy(scope); if(scope !== undefined) { if(!(_.isEqual(scopeObject, mainObject))){ //scope_copy.request_date = $filter('date')(new Date(scope.request_date), 'fullDate'); console.log('update'); scope.$update({pk: $routeParams.taskId}, function() { scope.request_date = $filter('date')(scope.request_date); mainObject = angular.copy(scope); }); mainObject = angular.copy(scope); } } }, true); </code></pre> <p>currently i think this code is somehow messy since it can't update decimal numbers. but currently i don't have a better solution. (i don't want to use a Button to submit the form, it should be done interactivly).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload