here is the context:
I have a list of users.
I also have a list of items and each item holds an Array of users.
The items list is displayed like that:
<ion-list>
<ion-item *ngFor="let item of items">
<ion-checkbox item-left [checked]="isChecked(item)" *ngIf="selected_user;"></ion-checkbox>
<ion-label>
<br>
<ion-badge *ngFor="let user of item.users"></ion-badge>
</ion-label>
</ion-item>
</ion-list>
Basically the checkboxes are revealed when a user is selected somewhere else.
What I am trying to do is to modify for each item its users array according to the status of the checkbox.
For instance, if item_a.users
contain user1
and selected_user
is user1
its checkbox revealed as checked
(I have that already) but now if item_b
and item_c
will be checked I want to add user1
to their users array and if item_a
is unchecked I want to remove user1
from its users array.
Is there any event to catch here? Is there a way to get all the status together in some data structure or I have to handle it individually for each item?
Thanks.
Aucun commentaire:
Enregistrer un commentaire