0

I'm having some problems loading a simple AngularJS with symfony app.

Here is my index.html.twig:

{% extends "::base.html.twig" %}


{% block body %}
    <div ng-app>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">

      <hr>
    </div>

{% endblock %}

{% block javascripts %}
    {% javascripts output='js/main.js' debug=false
    'bundles/acmesqltest/js/angular.min.js' -%}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

When i see the source code on the browser and click the angular.min.js reference.. all the code is there.

enter image description here

But, if i add, next to the input {{yourName}}, symfony says the variable does not exist.

enter image description here

Is there any other configuration that i need to do ?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Jhonatan Sandoval
  • 1,283
  • 6
  • 24
  • 40
  • 1
    You're probably running into a problem with {{}} being used in some other templating (within symphony I would guess) You can change the characters angular looks for for $interpolate to avoid the issue but even better you should write your service as a RESTful back-end that communicates with the front end via JSON request/response since this is decoupled and what is expected by angular's services ($http or $resource). – shaunhusain Apr 07 '14 at 19:12
  • Perfect! Also, I found this post http://stackoverflow.com/questions/13671701/angularjs-twig-conflict-with-double-curly-braces and it solve my problem. Thank you. – Jhonatan Sandoval Apr 07 '14 at 19:32
  • No problem glad you were able to get it sorted. – shaunhusain Apr 07 '14 at 19:33

0 Answers0