Answer the question
In order to leave comments, you need to log in
What is the correct way to set the value of a control in a @angular/forms reactive form?
There are many inputs in the form, the user enters values in certain of them, and after clicking on submit, the values of neighboring inputs are calculated based on these values.
The form model is created in the constructor using FormBuilder.group().
Here is an example:
form.controls['listingBrokerCommission'].setValue(sellingPrice * listingBrokerCommissionPercent / 100);
form.controls['estimatedSellersNetProceeds'].setValue(sellingPrice -listingBrokerCommission);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question