0

I have row of input fields and dropdowns. I can generate new row by clicking on button "Add row". I managed via "i of index" to get values for every input in that row, but I am unable to do that for dropdowns (also i get error when i select item from dropdown). When you fill inputs and select from dropdowns you can see result in console log after pressing button.

Plunker: Plunker

console.log example:

(2) [{…}, {…}]

0 : {name: "A", data: "123", num: "", char: ""} 1 : {name: "B", data: "123", num: "", char: ""}

Perhaps there is some other solution...

1 Answer 1

2

Why don't you just use the ng model property on it ?
Something like in this plunkr

<select [(ngModel)]="this.properties[i].num">
  <option selected disabled>Select type</option>
  <option *ngFor="let type of numberTypes">{{type}}</option>
</select>

<select [(ngModel)]="this.properties[i].char">
  <option selected disabled>Select type</option>
  <option *ngFor="let type of charTypes">{{type}}</option>
</select>
Sign up to request clarification or add additional context in comments.

2 Comments

Sure... any minute, there is time limit ;)
Sorry, I did not know that !

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.