I have a component with a reactive form
form = this.fb.group({
fullname: this.fb.group({
name: '',
lastName: '',
}),
income: this.fb.group({
preTax: '',
annualIncome: { value: '', disabled: true },
}),
job: '',
realName: false,
});
Although the annualIncome field is disabled i haved binded to a method that returns a number
<input
formControlName="annualIncome"
[value]="calculateAnnualIncome(form.value.income.preTax)"
type="text"
class="form-control">
The method called is:
calculateAnnualIncome(preTax) {
return preTax * 14 * ((100 - 21) / 100);
}
Although i see the value in the field when i am trying to retrieve it it returns ""
console.log(this.form.get('income.annualIncome').value)
output: ""
How can i receive the actual value of the field?