I am using *ngFor to loop through an array of objects and displaying the value in the HTML. In the HTML, the value is displayed in a input element as I want the user to change the value if required and then have the changed value saved using a Save button. Unfortunately the data binding is not working at all. The values from the array are not displaying. Here is my code:
<tr *ngFor="let data of rrReasons; let i = index;trackBy:trackByIndex;">
<td>
<input type="number" name=a{{index}} [(ngModel)]="rrReasons[index].signatory1">
</td>
And this is the json:
{ "signatory1" : "1009648", "signatory2" : "1003444", }
rrReasonsand you are using[(ngModel)]="rrReasons[index].signatory1", you should instead use thedatavariable you created like this[(ngModel)]="data.signatory1"