<ion-item *ngFor="let a of q.Answers">
<ion-label>{{a.AnswerDescription}}</ion-label>
<ion-checkbox (click)="addValue($event)" [(ngModel)]="a.checked"></ion-checkbox>
</ion-item>
the following return undefined
addValue(e): void {
var isChecked = e.currentTarget.checked;
console.log(isChecked);//undefined
}
hi ariang, you should have the checked value in a.checked of your function. In addValue you q.Answers should have the .checked changed to the new value.
I tried this and it is working :
<ion-item>
<ion-label>AnswerDescription</ion-label>
<ion-checkbox (click)="addValue($event)" [(ngModel)]="checked"></ion-checkbox>
</ion-item>
checked : boolean = true;
addValue(e): void {
var isChecked = e.currentTarget.checked;
console.log(e.currentTarget);//undefined
console.log(this.checked);//it is working !!!
}