# Listing of names for check boxes menu from list and dynamic addition of checkbox select menus

**URL:** <https://forum.ionicframework.com/t/listing-of-names-for-check-boxes-menu-from-list-and-dynamic-addition-of-checkbox-select-menus/121038>\
**Category:** ionic-v3\
**Created:** [February 9, 2018, 9:25pm UTC](https://forum.ionicframework.com/t/listing-of-names-for-check-boxes-menu-from-list-and-dynamic-addition-of-checkbox-select-menus/121038 "2018-02-09T21:25:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lado](https://avatars.discourse-cdn.com/v4/letter/l/ed8c4c/32.png) [@lado](https://forum.ionicframework.com/u/lado)\
**Post date:** [February 9, 2018, 9:25pm UTC](https://forum.ionicframework.com/t/listing-of-names-for-check-boxes-menu-from-list-and-dynamic-addition-of-checkbox-select-menus/121038/1 "2018-02-09T21:25:37Z")

</div>

hi,

I’m trying to figure out with two things at the same time in ionic2 application for one desired result.

I want to add names for check boxes menu from list `public names: any = [];` to get same menu, if I just list names into the **page.html** :

```
<ion-item class="ion-selector">
    <ion-label>Set 1</ion-label>
    <ion-select [(ngModel)]="SelectedValues1" multiple="true">
      <ion-option>Name1</ion-option>
      <ion-option>Name2</ion-option>
      <ion-option>Name3</ion-option>
    </ion-select>
  </ion-item>

```

If I have a list in my **page.ts** :

```
 this.names = [
      'Name1',
      'Name2',
      'Name3',
  ];

```

This way `*ngFor="let name of names"` seems incorrect, because I have list of check boxes instead of menu with check boxes:

```
<ion-item class="ion-selector" *ngFor="let name of names">
        <ion-label>Set 1</ion-label>
        <ion-select [(ngModel)]="SelectedValues1" multiple="true">       
          <ion-option> {{name}} </ion-option>          
        </ion-select>
      </ion-item>

```

Reason why I’m want to do that, I’m trying to figure out, what is a correct way dynamically add new menu of check boxes on empty form, in the amount that the user would like, with button “add” for example, to avoid two listings in form like this:

**Set 1** `[(ngModel)]="SelectedValues1"`:

```
 <ion-item class="ion-selector">
    <ion-label>Set 1</ion-label>
    <ion-select [(ngModel)]="SelectedValues1" multiple="true">
      <ion-option>Name1</ion-option>
      <ion-option>Name2</ion-option>
      <ion-option>Name3</ion-option>
    </ion-select>
  </ion-item>

```

same as if I add **Set 2** with `[(ngModel)]="SelectedValues2"`:

```
 <ion-item class="ion-selector">
    <ion-label>Set 2</ion-label>
    <ion-select [(ngModel)]="SelectedValues2" multiple="true">
      <ion-option>Name1</ion-option>
      <ion-option>Name2</ion-option>
      <ion-option>Name3</ion-option>
    </ion-select>
  </ion-item>

```

And then also must be passed to function:

`<button ion-button (click)="Go(SelectedValues1, SelectedValues2);">Ok</button>`

Advice would be helpful

---

<div class="post-metadata">

**Author:** ![FrancoisIonic](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/francoisionic/32/106767_2.png) [@FrancoisIonic](https://forum.ionicframework.com/u/FrancoisIonic)\
**Post date:** [February 10, 2018, 11:31pm UTC](https://forum.ionicframework.com/t/listing-of-names-for-check-boxes-menu-from-list-and-dynamic-addition-of-checkbox-select-menus/121038/2 "2018-02-10T23:31:46Z")

</div>

Hi, you could try to work with an input hidden in your view template, that creates an automatic record id, I used that somtimes in my app.

Something like that, in my app:

```auto
      <input type="hidden" [(ngModel)]="itemid" />
      <button ion-button block (click)="addItem(itemFamily)">{{ "ADD_THIS_ITEM" | translate }}</button>

```

And then, get this itemid value in the controller view, to launch or control code based upon this hidden id.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:51pm UTC](https://forum.ionicframework.com/t/listing-of-names-for-check-boxes-menu-from-list-and-dynamic-addition-of-checkbox-select-menus/121038/3 "2021-07-19T21:51:17Z")

</div>

Closed on July 19, 2021, 9:51pm UTC


