1

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>&nbsp;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.

1 Answer 1

3

I think checked is a property of the event passed to the function.

You can simply use event.checked instead of event.target.checked.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.