I'm creating a from group with existing values:
this.form = new FormGroup({
field1: new FormControl(
{
value: obj ? obj.value : null,
disabled: obj
},
Validators.required
),
field2: new FormControl(
{
value: obj ? obj.value : null,
disabled: obj
},
Validators.required
)
});
reproduction: https://stackblitz.com/edit/angular-aadkss
I want it to when obj exists to fill the values, to be valid and disabled, but it is filling the values, being disabled and invalid, not valid. How can I make it valid?