Last Updated: February 25, 2016
·
1.859K
· kevinsimper

Symfony Twig and Angularjs with the Curly Braces

Sometimes you want to make your angular inside twig templates, but that is a problem since they both use the same curly braces in their templating.

The easiest way is to use Twig's verbatim tag.

So it would like this with angular and twig together:

Hi {{username}}

{{ verbatim }}
<ul ng-repeat="action in actions">
  <li>{{action}}</li>
</ul>
{{endverbatim}}

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

AngularJS pages are long-lived browser apps with the same script risk as a newer single-page app. Third-party code in the template can read forms and values rendered on the page.

Security insights from Cside