Sharing data between Laravel and Angular

When building applications with Laravel and Angular you might come across a problem where you want to print data using AngularJS brackets {{}} but before it can be parsed by AngularJS, Laravel blade engine parses it and tries to replace the value if it finds one. Otherwise Laravel will start complaining about the variables. To solve that you just need to prepend brackets with @ sign so blade engine knows that you just need to ignore this expression and AngularJS will take care of it. And AngularJS will parse it and replace the variables with actual data.

Below is a sample snippet to do this:

@{{ article.body }}

In this snippet Laravel blade engine will ignore this and AngularJS will parse it and replace it with article.body data it has.

Advertisements

J Talk’s finds a new home at Medium

It has been a while that I haven’t wrote anything on my blog. It’s time to write some new stuff now but not on WordPress. Don’t worry! J Talk’s has find a new home at Medium. All the articles will be posted on Medium from now on. It is requested to all followers that they now follow me on Medium.

You can find my new home at https://medium.com/@jawaid

See you there!