Home:ALL Converter>angular 2, *ngFor checkbox check only one

angular 2, *ngFor checkbox check only one

Ask Time:2017-01-23T18:48:16         Author:sibi

Json Formatter

I’m trying to create a dynamic list with checkbox using *ngFor. Here, i want that the checkbox can be checked only one at a time (if user clicks the 2nd checkbox previously selected one should go unchecked).

<div class="img-prev col-md-12" *ngFor="let imgList of uploadedImg; let i = index">
  <div class="col-md-1">
      <input [ngModel]= "selectImg" (click)="updateSelection(i, imgList)" type="checkbox" /> 
  </div>
</div>

Author:sibi,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41804528/angular-2-ngfor-checkbox-check-only-one
yy