I am using Angular 9.
Question
How do I populate the following:
[ngClass]="{'is-invalid': approvalEditFormGroup.get('userName[0][0]').touched && approvalEditFormGroup.get('userName[0][0]').invalid}"
As you can see, I have hard-coded 'userName[0][0]'. Is it possible to replace the 0 values with the i and j variables?
I have the following:
html
<input formControlName="{{getFieldName(i,j)}}" matInput [matAutocomplete]="auto" [ngClass]="{'is-invalid': approvalEditFormGroup.get('userName[0][0]').touched && approvalEditFormGroup.get('userName[0][0]').invalid}">
ts
public getFieldName(i: number, j: number): string {
return 'userName['+i+']['+j+']';
}