Textarea inside <ion-textarea> typing same text to entire item-list . e.g xx is typing to all ion-items. how can I solve this issue . Thanks in adavance

<ion-item *ngIf="lead_id == item.sch_lead" class="border" >

  <ion-label>

    <h2 style="text-align:center; color:black; font-size:20px; font-weight:bold" >Company:{{item.company}}</h2>

    <h2 style="margin: 5px;"><strong>Date:</strong>{{item.sch_date}}</h2>

    <h2 style="margin: 5px;"><strong>Time:</strong>{{item.sch_time}}</h2>

    <h2 style="margin: 5px;"><strong>Reason:</strong>{{item.sch_reason}}</h2>

  </ion-label>

  <ion-checkbox slot="end" [(ngModel)]="item.isChecked"   ></ion-checkbox>

</ion-item>

<div class="border" *ngIf="item.isChecked">

  <ion-textarea  placeholder="Notes" clearOnEdit="true" [(ngModel)]="notes"></ion-textarea>

</div>

<div style="text-align:center">

  <ion-button *ngIf="item.isChecked" (click)="saveNotes(item.sch_id)" >Save</ion-button>

</div>

have you written [(ngModel)]="notes" for all of your ion-textarea in the above code i can see only one ion-textarea can you post the full code

thanks for response. It is dynamically inside ion-item means , every ion-item has 1 textarea. so no need

<div class="border" *ngIf="item.isChecked"> <ion-textarea placeholder="Notes" clearOnEdit="true" [(ngModel)]="notes"></ion-textarea> </div>

I’m not sure I understand what you’re saying here, but what I’m hearing is:

  • I’m looping this construct (outside the snippet I’ve posted) using an *ngFor on an enclosing element;
  • Therefore I don’t have to concern myself with whatever @achakra21 is asking about

If that’s an accurate understanding, then I would suggest rethinking your stance, because I agree with @achakra21’s suspicion here.

BAD:

<div *ngFor="let item of items">
  <ion-textarea [(ngModel)]="notes"><ion-textarea>
</div>

GOOD:

<div *ngFor="let item of items">
  <ion-textarea [(ngModel)]="item.notes"><ion-textarea>
</div>
1 Like

Yes Thanks . Thats the perfect solution . My issue is resolved… Once again thanks for saving my time. :heart_eyes: :heart_eyes: