Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I fetch data using vue.js into my view, so I want to pass parameters via vue.js to this route name. Like this:

<img :src="{{ route('getImage', image.path) }}" />

I've tried various approaches but without success:

<img src="{{ route('getImage', :image.path) }}" />
<img src="{{ route('getImage', @{{ image.path }} ) }}" />
<img src="{{ route('getImage', '@{{ image.path }}' ) }}" />

The basic method that works

<img :src="'/img/'+image.path" />

The controller:

public function getImage($filename, $params){ }

I want to pass more than one parameter to this route. Please any ideas.

Update: The question is already posted here but without solutions: Link to a route with a parameter of Vue.js

share|improve this question

It looks like you're trying to combine javascript and php, why not create the full path in image.path?

share|improve this answer
    
My images are stored locally and use this controller to have access, $file = Storage::diks('xxxx')->get($filename); So I prefer to don't have duplicate paths in my db. – Med May 22 '16 at 18:58
    
Both paths might not need to be stored though. It could be a derived attribute depending on your naming conventions. Sorry if this doesn't help, I don't know enough about your project. – chrisgaines May 22 '16 at 21:38

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.