allw
6
11
Vue

Accessing Array of Array

Posted 1 month ago by allw

I have returned an array of student objects to Vue, inside these objects are results arrays.

How do I attach a v-model to a specific one of these items depending on which 'paper' is being looped out? I know I cannot do the following but how would I do it?

<td v-for="(paper, key) in this.papers" :key="key"><input type="text" class="text-center" :id="(key) + '_' + (index +1)" v-model="student.results['paper_id' = paper.id].mark">
</td>

Even tried

<td v-for="(paper, key) in this.papers" :key="key"><input type="text" class="text-center" :id="(key) + '_' + (index +1)" v-model="student.results[key].mark">
</td>

Which also doesn't seem to work...

thanks!

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.