Skip to content

Should conditional type evaluation destroy data? #204

Closed
@Anthropic

Description

@Anthropic

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions