I am making an ID lookup form in Angular. I would like to create multiple formGroups, in the same HTML file, based off an array of values I have (keep it DRY). Each formGroup will be attributed to the same function, but use a different value as the argument. I need the formGroup to have different values (associated with the value in the array) for the formControlName, placeholder, labels, and button value.
I've tried ngFor with limited success.
var idNames = ['Organization', 'Site', 'Location', 'Device'];
Example HTML file
<form [formGroup]='organizationForm'>
<label>
Organization Id:
<input type="text"
formControlName='organizationId'
placeholder="Organization Id">
<button type="submit" (click)="idInfo()">Search for Organization</button>
</label>
</form>
<form [formGroup]='siteForm'>
<label>
Site Id:
<input type="text"
formControlName='siteId'
placeholder="Site Id">
<button type="submit" (click)='idInfo()'>Search for Site</button>
</label>
</form>
<form [formGroup]='locationForm'>
<label>
Location Id:
<input type="text"
formControlName='locationId'
placeholder="Location Id">
<button type="submit" (click)='idInfo()'>Search for Location</button>
</label>
</form>
<form [formGroup]='deviceForm'>
<label>
Device Id:
<input type="text"
formControlName='deviceId'
placeholder="Device Id">
<button type="submit" (click)='idInfo()'>Search for Device</button>
</label>
</form>