fixed autosave bugs
This commit is contained in:
parent
52632f3328
commit
cdd5c122aa
|
@ -65,21 +65,14 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
|||
});
|
||||
};
|
||||
|
||||
//Update/Save Form if any Form fields are Dirty and Touched
|
||||
$scope.$watch(function(newValue, oldValue) {
|
||||
|
||||
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
||||
delete newValue.visible_form_fields;
|
||||
debounceSave(DeepDiff.diff(oldValue, newValue));
|
||||
}
|
||||
});
|
||||
|
||||
//Autosave Form when model (specified in $attrs.autoSaveWatch) changes
|
||||
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
||||
|
||||
newValue = angular.copy(newValue);
|
||||
oldValue = angular.copy(oldValue);
|
||||
|
||||
delete newValue.visible_form_fields;
|
||||
delete oldValue.visible_form_fields;
|
||||
newValue.form_fields = _.removeDateFields(newValue.form_fields);
|
||||
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
|
||||
|
||||
|
@ -95,13 +88,13 @@ angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', fun
|
|||
$rootScope.finishedRender = true;
|
||||
}
|
||||
|
||||
console.log('Autosaving');
|
||||
console.log('\n\n----------');
|
||||
console.log('!$dirty: '+ !$formCtrl.$dirty );
|
||||
//console.log('Autosaving');
|
||||
//console.log('\n\n----------');
|
||||
//console.log('!$dirty: '+ !$formCtrl.$dirty );
|
||||
console.log('changedFields: '+changedFields);
|
||||
// console.log('changedFieldMap: '+changedFieldMap);
|
||||
console.log('finishedRender: '+$rootScope.finishedRender);
|
||||
console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
||||
//console.log('finishedRender: '+$rootScope.finishedRender);
|
||||
//console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
||||
// console.log('newValue: '+newValue);
|
||||
// console.log('oldValue: '+oldValue);
|
||||
// console.log(oldValue.form_fields);
|
||||
|
|
Loading…
Reference in a new issue