CmchPt CmchPt - 1 year ago 140
HTML Question

Angular 2 Mutually exclusive checkboxs

I have 2 checkboxes, when one is checked the other have to be unchecked, is there any way, using ngModel to block the selection of the other when one of them is already selected ?

<input type="checkbox" class="filled-in" id="checkIn" [(ngModel)]="checkboxFlag" checked />
<label id="labelIn" for="checkIn"> Inbound</label>
<input type="checkbox" class="filled-in" id="checkOut" />
<label id="labelOut" for="checkOut"> Outbound</label>

Answer Source

Either use radiobutton or use [disabled] and put in your condition

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download