3

i have a dynamic number of fields on the page and trying to bind an array to control changes on the page, but got stuck with v-model

Here is how i'm building a page (minimal example to reproduce):

<b-form-group v-for="(element, i) in banners" :key="i"  :label="'Banner ' + (i+1)">
  <input
    type="text" class="form-control"
    :v-model="element.name"
    :name="'bannername[' + i + ']'">
  <img :src="element.image" class="banner-preview">
</b-form-group>

This way i'm getting proper src for the img, but input is empty all the time. (checked the data by changing v-model to value, everything is fine, but i need to bind it here)

3
  • 2
    Did you try using v-model instead of :v-model? Commented Dec 21, 2017 at 20:27
  • damn, looks like i need a cup of coffee Commented Dec 21, 2017 at 20:30
  • @AlbertoRivera feel free to post it as an answer for my dumb question >.< Commented Dec 21, 2017 at 20:30

1 Answer 1

2

Use v-model instead of :v-model

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

Comments

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.