In my FormGroup, which I will refer to as form, I need to set multiple values from an object:
Here is the current code snippet:
if(form.get('value1') && myObj.val1){
form.get('value1).patchValue(myObj.val1);
}
if(form.get('value2') && myObj.val2){
form.get('value2).patchValue(myObj.val2);
}
if(form.get('value3') && myObj.val3){
form.get('value3).patchValue(myObj.val3);
}
Is there a more efficient way to achieve this without using so many if statements?