0

I would like to bind the field i want to use for the value field dynamically

I want to do something like this

<option [value]="item.{{fieldName}}">{{item._id}}</option>

Field name will be read from a config file. Can i do this kind of thing in angular ?

1
  • Why don't you do simply: getItem(fieldName) Commented Oct 3, 2017 at 14:37

1 Answer 1

4

Try using square bracket notation

[value]="item[fieldName]"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.