Add a hook to transform field config before forms are compiled #343
Comments
Actually this would be helpful for when using the same fields array multiple times. Right now I have to clone each copy of the fields config when creating formly-forms in an ng-repeat where each iteration uses the exact same fields array. |
Hmmm... Yeah, I suppose that internally we'll do something like this: const fieldTransform = $scope.options.fieldTransform || formlyConfig.extras.fieldTransform;
if (fieldTransform) {
$scope.fields = fieldTransform($scope.fields);
} That way you could either copy them yourself or simply modify them to maintain references to the correct field. The reason that I bring this up is that if But I think that kind of an implementation in |
I have pushed some tests for this feature. I've actually already developed this feature and gotten all the tests passing locally, but I want to give someone the chance to make their first OSS contribution, so here are some instructions (if you have already contributed to open source, please let someone else take this one):
|
#343 Add a hook to transform field config before forms are compiled
Thanks @stevebluck! This has been officially released in |
…butes to same ng-model for multiple directives
Corrected commit message. Added ability to add custom class to ngTransclude. Fixes formly-js#398. Added ability to add custom class to ngTransclude. Fixes formly-js#343.
Would be handy if
formly-form
invoked an overridable function informlyConfig
that allowed transforming the field's (adding/removing/modifying) before they're passed to theformly-field
directive. This would enable things like https://github.com/formly-js/angular-formly-json-schema and https://github.com/formly-js/angular-formly-siren-action to transform a json schema or siren action stuff into field configuration that formly understands. @ckniffen I think you have done some work on this for your own project. Any thoughts?The text was updated successfully, but these errors were encountered: