News for hackers. Stuff that matters.
Re:Everything you need to understand to start with AngularJS by geekam on Wednesday April 24, 2013 @03:43PM (#5603513)
If using with Django, is it possible to change the {{}} to something else?
Re:Everything you need to understand to start with AngularJS by monkeyfacebag on Wednesday April 24, 2013 @04:07PM (#5603636)
I don't know if it's possible but, in general, it's not a good idea to mix server-side and client-side templating. The Angular guys discuss this in one of the videos on the Angular channel (I found it for you here: http://www.youtube.com/watch?feature=player_detailpage&v...). The two reasons seem to be first, it's not clean and second, it's easy to introduce security issues.

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.

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...
Re:Everything you need to understand to start with AngularJS by martian on Wednesday April 24, 2013 @04:26PM (#5603740)
Yes, in your Angular app's config you can use the $interpolateProvider to adjust this. For example, to use [[ ]], just do this:

    var myApp = angular.module('myApp', [], function($interpolateProvider) {
        $interpolateProvider.startSymbol("[[");
        $interpolateProvider.endSymbol("]]");
    });
Re:Everything you need to understand to start with AngularJS by pattern on Wednesday April 24, 2013 @04:49PM (#5603870)
Shameless plug: I wrote a short post on this exact subject two days ago[1]!

I also describe how to display the '{{' and '}}' strings in Jinja2, which is comically non-trivial :D

[1]: http://www.verdantrefuge.com/writing/2013/angularjs-custom-s...

Re:Everything you need to understand to start with AngularJS by ebidel on Wednesday April 24, 2013 @04:37PM (#5603806)
Yes, you can change the start and end symbols to be whatever you want: http://stackoverflow.com/questions/8302928/angularjs-with-dj...