-2
i have 5 formBuilder fields. 5 are filled with data coming from the database. but this data can be changed by the user
formNum: Formgroup;
recebeDados(){
this.serviceEndpoint.pegarValores().subscribe(res=> {
this.formulario(res.data);
});
}
formulario(result: Dados){
this.formNum = this.fb.group({
campo1: result.dado1,
campo2: result.dado2,
campo2: result.dado3,
campo2 :result.dado4,
campo2: result.dado5
});
}
need to dynamically form this form Builder. for example, these inputs have their initial values:
input1 => 0.3
input1 => 0.7
input1 => 5
total=> 6
but the user went and changed a field:
input1 => 1
input1 => 0.7
input1 => 5
and the total needs to change together: total=> 6.7
any idea?