Stephan-v
Stephan-v

Reputation: 20309

Echoing vue.js data with laravel?

I am currently echoing some data from vue.js in laravel like so:

<a href="/beers/@{{ beer.id }}">
    <img src="@{{ beer.path }}" alt=""/>
</a>

It works but my console gives me the following error twice:

http://beerquest.dev/%7B%7B%20beer.path%20%7D%7D

Any other variables that I have printed out work fine because they are not within double quotes probably.

Funny enough everything seems to work fine though but I would like to get rid of the messy console messages. Does anybody know how to fix this?

Upvotes: 0

Views: 1682

Answers (1)

Alupotha
Alupotha

Reputation: 10093

Try without @ sign

<a href="/beers/{{ beer.id }}">
    <img src="{{ beer.path }}" alt=""/>
</a>

@ symbol will be removed by Blade; however, {{ name }} expression will remain untouched by the Blade engine, allowing it to instead be rendered by your JavaScript framework.

http://laravel.com/docs/5.1/blade#displaying-data

Upvotes: 3

Related Questions