Skip to content

Instantly share code, notes, and snippets.

@ericlbarnes
Created February 19, 2015 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ericlbarnes/f820e0acde5965d8be99 to your computer and use it in GitHub Desktop.
Save ericlbarnes/f820e0acde5965d8be99 to your computer and use it in GitHub Desktop.
Use Laravel Blade And AngularJS Together

By default AngularJS and Blade conflict with the way variables are called. Both use a double curly bracket {{ var }} syntax. There are a few workarounds such as changing Angular’s or Blade’s delimiters but an easier method is available.

Inside blade prefix Angular echo variables with the at “@“ symbol. Here is an example:

<li ng-repeat="phone in phones | filter:query | orderBy:orderProp">
    <span>@{{phone.name}}</span>
    <p>@{{phone.snippet}}</p>
</li>

This will prevent blade from parsing it but will be correct when sent to the browser.

Nice and simple!

@odyright
Copy link

goood!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment