I am working on reactive forms of angular where I have a requirement in the forms as below
Lets say I have 4 input fields.
<input type="text" formControlName="a1">
<input type="text" formControlName="a2">
<input type="text" formControlName="a3" value={{a1+a2}}>
<input type="text" formControlName="a4" value={{a1*a2}}>
here value is based on formula which may have any arithmetic expression example : (a1*a2)/a3
This form is dynamic data is coming from an api for example
const formData = [
{
id: "a1",
type: 'text',
value: '',
formula: '',
},
{
id: "a2",
type: 'text',
value: '',
formula: '',
},
{
id: "a3",
type: 'text',
value: '',
formula: 'a1+a2',
},
{
id: "a1",
type: 'text',
value: '',
formula: 'a1*a2',
},
];
please help me with this.enter image description here