Is there a way to create a custom fieldtype in angular schema form that is able to sum other fields on the form? I've looked at directives/decorators but am not sure how to reference the fields to be summed?
相关问题
- How to handle onChange with Angular Schema Form Ch
- how to generate form dynamically in angular js?
- Focus on the first field that is .ng-invalid at Su
- angular schema-form modal…problems with $scope
- angular schema form - how can I create a “total” f
The easiest way is probably to let the user supply the keys of the fields you'd like to sum up the and watch for changes with a
$watchGroup
So an example of how a form definition could look:
And then you need a directive in your field type sum to actually sum things up. (WARNING, untested code)
You could also do a fieldset type of thing and loop through each item in the
items
property of the form and go from there. ThesfSelect
service might also be useful. Hope that helps!