AngularJS with Django - Conflicting template tags AngularJS with Django - Conflicting template tags django django

AngularJS with Django - Conflicting template tags


For Angular 1.0 you should use the $interpolateProvider apis to configure the interpolation symbols: http://docs.angularjs.org/api/ng.$interpolateProvider.

Something like this should do the trick:

myModule.config(function($interpolateProvider) {  $interpolateProvider.startSymbol('{[{');  $interpolateProvider.endSymbol('}]}');});

Keep in mind two things:

  • mixing server-side and client-side templates is rarely a good idea and should be used with caution. The main issues are: maintainability (hard to read) and security (double interpolation could expose a new security vector - e.g. while escaping of serverside and clientside templating by themselves might be secure, their combination might not be).
  • if you start using third-party directives (components) that use {{ }} in their templates then your configuration will break them. (fix pending)

While there is nothing we can do about the first issue, except for warning people, we do need to address the second issue.


you can maybe try verbatim Django template tag and use it like this :

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>{% verbatim %}<div ng-app="">    <p>10 is {{ 5 + 5 }}</p></div>{% endverbatim %}