0

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 Incomming Array I want to bind ID with my input value.

3
  • You can use[ (ngModel)]="entressEmployee.id" Commented Nov 8, 2018 at 10:39
  • how to bind with input value together for one of another array? Commented Nov 8, 2018 at 10:41
  • 1
    <input type="number" [(ngModel)]="entressEmployee.ID" class="form-control" placeholder="Value"> Commented Nov 8, 2018 at 10:45

3 Answers 3

1

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 !!

Sign up to request clarification or add additional context in comments.

Comments

1

you can use property binding

<td> <input type="number" value={{entressEmployee.ID}} class="form-control" placeholder="Value">

1 Comment

no, i want to entressEmployee.ID with input value together
1

simply use ngModel

<td> <input type="number" [(ngModel)]="entressEmployee.ID" class="form-control" placeholder="Value">

1 Comment

can i push to array both of ID and input value?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.