Reputation: 306
I have list of Array in a table , I want to bind input value with list of array Id separately to the array here my html <tr *ngFor="let entressEmployee of EntressForEmployee; let e = index ">
<td style="text-align:left">{{entressEmployee.Description}}</td>
<td> <input type="number" class="form-control" placeholder="Value"> </td></tr>
and my EntressForEmployee Array look like this
I want to bind ID with my input value.
Upvotes: 0
Views: 1915
Reputation: 2128
Use your input of type='text'
and then bind using [(ngModel)]
like this
<tr *ngFor="let entressEmployee of EntressForEmployee; let e = index ">
<td style="text-align:left">{{entressEmployee.Description}}</td>
<td> <input type="text" class="form-control" placeholder="Value" [(ngModel)]='entressEmployee.ID'>
</td>
Finally don't forget to import FormsModule
in your AppModule
- Happy coding !!
Upvotes: 1
Reputation: 41377
simply use ngModel
<td> <input type="number" [(ngModel)]="entressEmployee.ID" class="form-control" placeholder="Value">
Upvotes: 1
Reputation: 151
you can use property binding
<td> <input type="number" value={{entressEmployee.ID}} class="form-control" placeholder="Value">
Upvotes: 1