I have 60 properties linked to 60 controls through the mat-tab
in a form. When it comes to editing mode, I need to assign values to all the controls.
One approach is as follows:
this.form.controls['dept'].setValue(selected.id);
This involves locating each control and setting its value individually.
Is there a simpler method, such as:
this.form.setValue(modelName);
Or any other easier way for me to set values without having to write 60 lines of code?
My forms are built using ReactiveForms
.