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.
-
You can use[ (ngModel)]="entressEmployee.id"Sunil– Sunil2018-11-08 10:39:11 +00:00Commented Nov 8, 2018 at 10:39
-
how to bind with input value together for one of another array?P Rane– P Rane2018-11-08 10:41:25 +00:00Commented Nov 8, 2018 at 10:41
-
1<input type="number" [(ngModel)]="entressEmployee.ID" class="form-control" placeholder="Value">Sunil– Sunil2018-11-08 10:45:20 +00:00Commented Nov 8, 2018 at 10:45
Add a comment
|
3 Answers
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 !!
Comments
you can use property binding
<td> <input type="number" value={{entressEmployee.ID}} class="form-control" placeholder="Value">
1 Comment
P Rane
no, i want to entressEmployee.ID with input value together
simply use ngModel
<td> <input type="number" [(ngModel)]="entressEmployee.ID" class="form-control" placeholder="Value">
1 Comment
P Rane
can i push to array both of ID and input value?