lundi 15 juillet 2019

Angular: link two different checkbox from a list

I've been struggling for hours to realise a list where I have two checkboxes dependent on each other.

Basically, I have a list of cars. On some of them, I want to select them as blue or red. If I say on is blue I want the checkbox to be unchecked.

How can I do?

<tr *ngFor="let car of cars |let i = index;"> 
    <td>
         €
    </td>
    <td>
        <input type="checkbox" value="car.id" (change)="onCarBlue($event,i)">
    </td>
    <td>
        <input type="checkbox" value="car.id" (change)="onCarBlue($event,i)">
    </td>
</tr>




Aucun commentaire:

Enregistrer un commentaire