lundi 30 décembre 2019

ngModel and checkbox/radio not working properly

I made html template for my app. Basically it's a radio/checkboxes with text inputs which contain answers to questions. It worked just fine until I've decided to add ngModel to them. The thing is that when I add 2 or more answers and click on a label to set the correct one(/s) only the last one selects, moreover the answertext dissapears whenever I click on label.

html text:

<div  *ngIf="question.typeQuestions==1">                
  <div *ngFor="let item of question.selectedAnswer; let i = index" class="checkbox-variable">
   <input type="checkbox" id="customCheckbox" name="customCheckbox" class="checkbox-square" [(ngModel)]="item.isCorrect" >
    <label class="checkbox-label" for="customCheckbox"><input class="checkbox-text" type="text" [(ngModel)]="item.text"></label>
 </div>
</div>  



Aucun commentaire:

Enregistrer un commentaire