我想循环知道复选框的其中一个答案是否为“true”
我的代码Html:
<ion-list>
<ion-item *ngFor="let modalite of current.modalites ; let i=index">
<ion-label>{{modalite}} {{i}}</ion-label>
<ion-checkbox color="PFG"
[(ngModel)]="current.response[current.valModalites[i]]" checked="false">
</ion-checkbox>
</ion-item>
</ion-list>
我的代码JS:
case "question_fermee_checkbox":
console.log("checkbox");
console.log(this.current.response,this.current.numero_question )
while(verif < this.current.response.length){
verif++
}
retour= true;
break;
谢谢您的帮助!
也许这样,未经测试,因为我没有你的设置。我刚刚填写了遗漏的内容。
case "question_fermee_checkbox":
console.log("checkbox");
console.log(this.current.response,this.current.numero_question )
retour = false;
for(var verif = 0; verif < this.current.response.length; ++verif){
var checkbox = this.current.response[verif];
if(checkbox.checked) {
retour= true;
break;
}
}
break;