Question: I read out an array of user objects with \*ngFor. I want to remove objects with a "remove" checkbox and set button (next to each row in a table). How can I pass the state of the checkbox to the setUser function.

```
<ion-row class="userList" *ngFor="let user of users">
    <ion-col col-5 class="userName">
        {{user.firstname}} {{user.lastname}}
    </ion-col>
    <ion-col>
        <ion-checkbox></ion-checkbox> <span>Remove</span>
    </ion-col>
    <ion-col>
        <!--How can I read out the value of the checkbox above-->
        <button ion-button color="primary" (click)="setUser(user._id,???)">Set</button>
    </ion-col>
</ion-row>

```

Answer: 
Try this.

Set template reference variable of your checkbox "userCheckbox" in this example. 

```
<ion-checkbox #userCheckbox></ion-checkbox>

```

Then pass that variable of checkbox value, it will be true/false. 

```
<button ion-button color="primary" (click)="setUser(user._id,userCheckbox.value)">Set</button>

```
If you don't want `[(ngModel)]` to be used at all:

Create an array say `checkedUsers` (size equal to number of users) and initialize them as `false`

`<ion-row class="userList" *ngFor="let user of users; let i = index"> // add index)`

`<ion-checkbox [checked]="checkedUsers[index]"></ion-checkbox>` // or [value]

`(click)="setUser(user._id, index)"`

```
setUser(userid, index){
   this.checkedUsers[index] = true;
}

```

This approach isn't the recommened way, you can continue with [Sajeetharan](https://stackoverflow.com/a/54276948/5482640) way