I am building dynamic input fields with a mandatory check inside ngFor. I have built names using field{{idxVar}} where idxVar is index but how do I use this for checking error
<span [ngClass]="{'active' : field{{idxVar}}.errors}">*Mandatory</span>
<input type="text" [required]="itmVar.is_required ? 'required' : null" name="field{{idxVar}}" [(ngModel)]="user.customFields[idxVar]"
#field{{idxVar}}="ngModel">
In above, I know this is not the right method which gives error but want to know the right syntax for this
'active' : field{{idxVar}}.errors