How to handle dependencies between Angular form controls?

Viewed 239

I'm developing an Angular (12) reactive form with lots of direct and indirect dependencies between the form control values. Example: The tax rate is dependent on the selected country, the date and the selected receipt type, but it can also be set manually. Changes of the tax rate trigger changes to the net amount. But the net amount can also be set manually with leads to changes of the gross amount. And so on...

I tried to handle these dependencies with the form control valueChanges subscriptions and with on blur events of the control components, but this ends up in an event handler hell where one change overwrites the other.

What is the way to handle complex dependencies between Angular reactive form controls in a clean, clear and maintainable way? I couldn't find a suitable example for this.

1 Answers
Related