How can I bind data in ngFor?


I have a problem in input text, when I write in one input it changes in the other input as well ! how can I fix that !
HTML code:

  <mat-expansion-panel  class="childPanel" [expanded]="true" hideToggle disabled style=" background:#F2EDFF;" *ngFor="let i of listSousCategorie"   >
            <div class="childPanel_body2 mat-badge-large" fxLayout="row" fxFlex fxLayoutAlign="start center"  >
              <div style="padding-left:1em" fxFlex="grow" >{{i.libelle}} {{}}</div>
              <mat-form-field  >
                <form [formGroup]="form" (ngSubmit)="onSubmit(">
                <input  type="text" matInput  formControlName="Note" [(ngModel)]="Note" >

TS Code:


     ngOnInit() {
        this.form ={
          Note: [''],
              onSubmit(id:number) {
                  let obj = this.form.value;
                  obj.Note = this.Note;
                  this.LExamenSousCategorieService.updateSouCategorie(obj,id).then(res => {

enter image description here

Source: Angular Questions

Categorized as angular, html Tagged ,


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us