I have been trying to figure out the best way to set a series of ion-checkbox
's using an array that is fed into my app through an API.
Right now, my app receives some data that looks like this:
{
"data": {
"tags": [
55, 46, 193, 1002
]
}
}
I am then using a series of ion-checkbox
's to display whether or not that tag is selected for a certain item, like this:
<ion-item lines="full">
<ion-label position="fixed" class="ion-text-wrap">Blue</ion-label>
<ion-checkbox slot="end" [(ngModel)]="item.tags"></ion-checkbox>
</ion-item>
I am having some confusion around how I can set the model for item.tags
to be associated back to the array of data I am receiving from the data feed.
Is there a value field in the ion-checkbox
I can set that would then allow the checkbox to appeared to be check with the data.tags
array has the matching value?