Reputation: 9289
i am trying to figure out if a checkbox is checked or not when user clicks on it.
below is the code
<ion-item-group>
<ion-item-divider color="light"><ion-icon name="warning" style="color:#FFBA55"></ion-icon> Overdue Tasks</ion-item-divider>
<ion-item> <ion-label class="label-style">item 1</ion-label>
<ion-checkbox (ionChange)="updateToDo($event)"></ion-checkbox></ion-item>
<ion-item> <ion-label class="label-style">item 2</ion-label>
<ion-checkbox (ionChange)="updateToDo($event)"></ion-checkbox></ion-item>
</ion-item-group>
the updateTodo looks like:
updateToDo(event){
alert(event.target.checked)
}
but this throws undefined action for target property on event.
Upvotes: 1
Views: 4596
Reputation: 1127
I think checked
is a property of the event passed to the function.
You can simply use event.checked
instead of event.target.checked
.
Upvotes: 3