I am facing an issue with binding the checked attribute value on an ion-checkbox, as the behavior seems to be delayed.
In my .ts file, I have an array variable named user_id
. In my checkbox list, I am trying to populate this array based on which checkboxes are checked. Here is the code snippet:
<ion-checkbox [checked]="user_id.includes(user.id) ? true : false" (click)="AddUser(user)"><ion-checkbox>
Although the user_id
array is filled and the value of checked changes, the checkbox does not visually reflect this change. When I try to recheck the checkbox, the value changes to false but the checkbox appears checked.
I have added some functionality to conditionally hide the checkboxlist if a variable type
is true. Interestingly, when the type changes from false to true, the checkbox starts working correctly, but there is still a slight delay in its behavior when initially checked for the first time.
TL;DR
The click event works properly with my checkbox, but the data retrieval process is inconsistent.