I'm pushing a FormArray with some values, and i need to dynamically set disabled property in certain fields after i've loaded a list. My question is: IS there a way to set the value and set the disabled property using only patchValue?
I've tried something like this.rowArray.controls[index].patchvalue({format: "NUMBER", disabled:true}) but it doesn't seem to work.
this.rowList.forEach((el, index) => {
this.rowArray.push(
this.fb.group(
{
name: new FormControl(el.name, [
Validators.required,
Validators.maxLength(30),
Validators.pattern(this.BAN_SPECIAL_BUT_UNDERSCORE)
]),
source: new FormControl(el.source, Validators.required)
.....
and after that
if (this.rowArray.controls[index].get("source").value === "CSV") {
this.rowArray.controls[index].patchValue({
format: "NUMBER",
disabled: true
});
}
rowList is my matrix that comes from backEnd.