# Wrong displayed values in dynamically added elements

**URL:** <https://forum.ionicframework.com/t/wrong-displayed-values-in-dynamically-added-elements/125578>\
**Category:** ionic-v3\
**Created:** [March 22, 2018, 9:31pm UTC](https://forum.ionicframework.com/t/wrong-displayed-values-in-dynamically-added-elements/125578 "2018-03-22T21:31:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![J13t0u](https://avatars.discourse-cdn.com/v4/letter/j/b19c9b/32.png) [@J13t0u](https://forum.ionicframework.com/u/J13t0u)\
**Post date:** [March 22, 2018, 9:31pm UTC](https://forum.ionicframework.com/t/wrong-displayed-values-in-dynamically-added-elements/125578/1 "2018-03-22T21:31:35Z")

</div>

EDIT 2: I have kind of solved it by replacing `[(ngModel)]="item.value1"` with `value={{item.value1}}`. The change works just fine for me, but I still want to know the solution to my original question. Thanks.

I have a form that has parts of it that can be dynamically expanded.

```auto
<div *ngFor="let item of itemArray; let index = index">
        <ion-item>
          <ion-label color="primary">{{index+1}}</ion-label>
          <ion-input type="text" [(ngModel)]="item.value1" ></ion-input>
          <ion-input type="text" [(ngModel)]="item.value2" ></ion-input>
        </ion-item>

        <span ion-button float-left icon-left clear (click)="Remove(index)">
          <ion-icon name="close"></ion-icon>Remove
        </span>
</div>

<span ion-button float-left icon-left clear (click)="Add()">
        <ion-icon name="add"></ion-icon>ADD
</span>

```

In the ts file

```auto
Add(){
    this.itemArray.push({
      'value1':'',
      'value2':''
    });
  }

  Remove(i){
    this.itemArray.splice(i, 1);
  }

```

If i just manually type into each input field, everything displays just fine. But I have another function that dynamically changes the `itemArray` like this

```auto
changeInput(change, index){
    this.itemArray[index]['value1'] = change;
}

```

Problem arises when I call the changeInput function, instead of just changing the particular input field, all of the input field that is pointed to ‘value1’ is changed into the same thing, however, if I console log the array, everything in the array appears to be correct. So something is wrong with how the front end is displayed.

Is there something that I’m doing wrong, or are the dynamically added input fields unable to be changed like that.

EDIT 1: upon further testing, every dynamically added fields’ front end value are all updated to the nothing after called Add(), however, the itemArray is still correct after console logging it, it still keeps whatever was entered in it and the empty newly added member.

---

<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:44pm UTC](https://forum.ionicframework.com/t/wrong-displayed-values-in-dynamically-added-elements/125578/2 "2021-07-19T21:44:02Z")

</div>

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


