Answer the question
In order to leave comments, you need to log in
How to properly work with symfony and angularjs ?
Goodnight!
I decided to see what kind of animal this angularjs is .
I work on symfony2 , I decided to try to implement the page on angularjs.
Interests as it is correct to work with the data in such sheaf.
The options that I see so far:
1) SymfonyController sends a selection from the database in the form of objects (json array, etc.) to the template (twig).
Next, we somehow have to give this array to angular. Actually interested in how?
ngInit? and into it something like ng-init="list='{{list|json_encode|raw}}'"
Angular controllers in a separate file.
2) Make $http ajax request to symfony controller which will return JsonResponse to us
Well, then give it to the template and let ngRepeat understand it there.
Maybe there are some other options?
PS
Angular changed brackets to square
Answer the question
In order to leave comments, you need to log in
How to work properly with symfony and angularjs
<script>
angular.module('app.data', []).constant('myMandatoryData', {{ data | json }});
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question