Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

In Vue.js I'm trying to pass values from a loop as properties for a custom component.

<template v-for="upload in uploads">
   <upload-container index="{{ $index }}" filename="{{ upload.name }}"></upload-container>
 </template>

Unfortunately this does not work and it only passes through the literal strings {{ $index }} and {{ upload.name }} instead of the actual values.

share|improve this question

The values are in fact, passed down as strings. If you want to evaluate the expressions you need to use dynamic syntax.

<template v-for="upload in uploads">
   <upload-container :index="$index" :filename="upload.name"></upload-container>
 </template>

Literal vs Dynamic

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.