angularjs - Best way to save/update a resource with ($watch or save button, etc..) -
currently run following problem, working on form heavy application , wanted user experience tried stop have save / update button everywhere.
currently try $watch every form change, won't work correctly since updates scope when model gets updated causing problems on decimal / money values.
what prefer? still messy save button or maybe gmail did?
what methods without save buttons.
/* edited */ use method update our form. first copys scope in object , checks if same object set after date got pulled.
$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); currently think code somehow messy since can't update decimal numbers. don't have better solution. (i don't want use button submit form, should done interactivly).
Comments
Post a Comment