Closed
Description
I have an attribute directive I applied to my own decorator to remove data that was in elements hidden by a conditional type evaluation.
Should this perhaps be included in the main angular-schema-form behaviour?
(function(window, angular, undefined) {'use strict';
angular
.module('schemaForm.extension',[])
.directive('destroyHiddenData', ['oySchemaFormUtil', function(oySchemaFormUtil) {
return {
link: function(scope, element, attrs) {
scope.$on('$destroy', function(){
if(scope.form.key) oySchemaFormUtil.setKeyValue(scope.model, scope.form.key, '');
})
}
};
}]);
})(window, window.angular);
Note: the oySchemaFormUtil is my own function that just manipulates data based on key, but unlike the built in one it also allows for total deletion which is why I use it instead. Not relevant to discuss in this post thread.