I need some help. I'm trying to disable the rest of the switches if one is selected, as only one is allowed. I've tried doing loops approach but no success. Here is my code.
HTML file
<label class="switcher switcher-success ml-3">
<input
type="checkbox"
class="switcher-input"
(change)="registerProduct(i, $event.target.checked)"
/>
<span class="switcher-indicator">
<span class="switcher-yes">
<span class="ion ion-md checkmark"></span>
</span>
<span class="switcher-no">
<span class="ion ion-md-close"></span>
</span>
</span>
</label>
Ts file
public registerProduct(index, value) {
this.isChecked = value;
// tslint:disable-next-line: prefer-const
this.product = this.products[index];
if (value) {
this.includedProducts.push({
EntityTypeId: '49e185d1-529c-4b7a-a6fb-245649624a14',
EntityTypeName: 'Producto',
EntityId: this.product.ProductId,
EntityName: this.product.ProductName,
Required: true,
});
}
}
