phpMick
56
4
Vue

How to pass an array as a prop?

Posted 4 months ago by phpMick

Is this correct?:

<agreements-selector 
                                           :selected-agreements='{{ json_encode($groupingRule->agreement_ids)}}'>


I'm sure I have done this before and didn't have to use json_encode?

agreement_ids is cast to an array in the model.

Thanks,

Mick

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.