0

I am trying to access a named laravel route in my Reply.vue file. What i am trying to do is pass this route as an attribute to my reply component. But while compiling i get the following error:

invalid expression: Unexpected token : in

http://tddforum.com/thread/reply/10

Raw expression: :route="http://tddforum.com/thread/reply/10"

As you can see the value of the route is correctly assigned to the :route attribute but the page wont load due to the error stated above. Here is the first line of my reply component:

<reply :attributes="{{ $reply}}" :route="{{ route('reply.update',$reply->id) }}" inline-template>

what is wrong here?

Thanks, Yeasir

1 Answer 1

2

You are using v-bind which evaluates the value as JavaScript, but you are actually passing a string literal, so simply remove the v-bind (the colon):

<reply :attributes="{{ $reply}}" route="{{ route('reply.update',$reply->id) }}" inline-template>

If reply is also a string then you will need to do the same for that as well.

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

1 Comment

Yes, that worked!! And now have a better understanding of how the binding works. Thanks a lot :)

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.