# Ion-checkbox with Ionic 2

**URL:** <https://forum.ionicframework.com/t/ion-checkbox-with-ionic-2/92640>\
**Category:** ionic-v3\
**Created:** [June 1, 2017, 10:58am UTC](https://forum.ionicframework.com/t/ion-checkbox-with-ionic-2/92640 "2017-06-01T10:58:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yewness](https://avatars.discourse-cdn.com/v4/letter/y/ea5d25/32.png) [@yewness](https://forum.ionicframework.com/u/yewness)\
**Post date:** [June 1, 2017, 10:58am UTC](https://forum.ionicframework.com/t/ion-checkbox-with-ionic-2/92640/1 "2017-06-01T10:58:54Z")

</div>

![image](https://global.discourse-cdn.com/ionicframework/original/3X/5/f/5f5bd30e0fea360542bdd99703d615100f53f61b.png)

Hi guys, was trying to return an array of ids in the ion-checkbox but no avail.

These are my current code.

survey.ts

```auto
this.surveyForm = this.formBuilder.group({
  questions: formBuilder.array([])
})

let question = formBuilder.group({
    question_id: [this.questions[i].id, Validators.required],
    answer_ids: formBuilder.array([
  ])
});

this.surveyForm.controls['questions'].push(question);

for (var j = 0; j < this.questions[i].answers.length; j++) {
  let answer = formBuilder.array(this.questions[i].answers)
  // this.surveyForm.controls['questions'].push()
};
console.log(this.surveyForm.controls.questions)

```

survey.html

```auto

<ion-list formArrayName="answer_ids">
  <div *ngFor="let choice of question.answers; let j = index">
    <ion-item>
      <ion-label style="white-space: normal;">{{ choice.id }}</ion-label>
      <ion-checkbox (ionChange)="onChange(choice.id, $event._checked)" value="choice.id"></ion-checkbox>
    </ion-item>
  </div>
</ion-list>

```

My current goal is to get that “answer\_ids”: [81,82,83] for checked checkbox. Btw the questions are in nested form, probably there must be a way to segregate the answers control between question\_id.
