Re:Everything you need to understand to start with AngularJS
by kevinastone on Wednesday April 24, 2013 @05:35PM
(#5604142)
That security concern is nonsense. Use {% verbatim %} as noted below for angular templates (there's plenty of backports for Django <1.5). I have django templates fill in runtime parameters (csrf_tokens, etc) all the time.
Re:Everything you need to understand to start with AngularJS
by abibibo on Wednesday April 24, 2013 @04:24PM
(#5603724)
Django 1.5 introduced {% verbatim %} {% endverbatim %} which takes care of what you describe.
https://docs.djangoproject.com/en/dev/ref/templates/builtins...
If I want to have a page that has both server-side templating and client-side templating, I push the ng-app directive down into the DOM and assert that Angular has "ownership" of that portion of the page. I can't remember what Django's templating engine supports, but in Jinja2, you can create a {% raw %} {% endraw %} block that tells Jinja2 not to parse any delimiters in the block (I'm sure Django has something like this, I just can't recall what it is). This makes it pretty easy to separate out Angular's purview from the server's purview even on a single page.