Ion-checkbox : Set array for P and A value in array while checkbox

Hello Developer

I need array should be updated while check or uncheck in ion-checkbox by pressing checkbox entire array should be change attendance value means if checked it should be attendance : “P” While unchecked it should be “A”. in entire array.

“attendance”: [
{
“id”: “3”,
“attendance”: “P”
},
{
“id”: “6”,
“attendance”: “A”
}]
}

I will not write the whole code for you but with the following code snippet, you should be able to do what you need.

<ion-checkbox (ionChange)="doSomething($event)"></ion-checkbox>
function doSomething(event) {
    console.log(event);
    // your logic here
}
1 Like