SuperOcean
1106
5
Vue

Pass associative array from blade to vuejs

Posted 1 year ago by SuperOcean

Guys, could you please help out:

I have a Laravel controller pass an array ($lorem) that looks like this:

array:3 [▼ "nulla" => 5 "tincidunt" => 5 "eget" => 5 ]

In the Laravel blade, if I want to access this array, I can do this:

@foreach ($lorem as $key => $value)

....

@endforeach

Which works fine, but when I pass this array to vuejs the v-for just spits out this:

{ " n u l l a " : 5 , " t i n c i d u n t " : 5 , " e g e t " : 5 }

One line per character.

I am using this Jeff tutorial: https://laracasts.com/series/learning-vue-step-by-step/episodes/10

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

Reply to

Use Markdown with GitHub-flavored code blocks.