1

How do I update this input to work with Vue.js 2?

<input value="{{item.id}}" type="text" name="emails[{{$index}}]['id']" />

This is as far as I've got:

<input :value="item.id" type="text" class="form-control" name="emails[{{$index}}]['id']" />

I'm not sure how to update the name attribute.

1 Answer 1

1

For name as well you have to use v-bind or in short : like following:

<input :value="item.id" type="text" class="form-control" 
  :name="emails[$index]['id']" />
Sign up to request clarification or add additional context in comments.

1 Comment

Ah! Where I was getting stuck was with inside the name I didn't know I could use $index instead. Thank you so much!

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.