I recently started using Angular 2 with Typescript and I am working on creating a list of checkboxes to manage their states.
Similar to how some shopping websites function, the checkboxes represent different companies. Users can select multiple checkboxes and then press a search button to display products from those selected companies.
<ul class="companies">
<li *ngFor="let company of companies">
<input type="checkbox">{{ companies.name }}
</li>
</ul>
The "companies" array is retrieved from the database, where each company has an id and a name. Using *ngFor allows us to repeat the li element for each company in the array, displaying a checkbox next to the company name.
Without assigning individual ids to each checkbox, it becomes challenging to track their states. Any guidance on how to accomplish this would be greatly appreciated.