Reference article: http://yanhua365.lofter.com/post/b417f_1f0361
Http://stackoverflow.com/questions/8302928/angularjs-with-django-conflicting-template-tags
http://blog.boxelderweb.com/2012/11/16/providing-django-template-variables-as-constants-to-angularjs/
In front of that, the current version of the Django template has a verbatim
¶ tag, is the right way to do this thing.
This {{}} tag conflict issue, in the latest version of Django 1.5 presented a template built-in solution verbatim tags: https://docs.djangoproject.com/en/1.5/ref/templates/ builtins/#verbatim The contents of this tag can be avoided by the server-side template parsing. Using the 1.4 and previous versions of the students can consider using the system built-in label Templatetag output special strings, or with the following scheme, is to write fewer characters. Special custom-made a bit. As for the client template configuration solution, look at the above reference article.
Mainly refer to the first article in the middle, with the server-side tag to output the client's desired label solution, because the template is everywhere {{"}}"}} Such text is easy to confuse, so the output is packaged into Django
The included label resolves, where the output of the double curly braces is also used as a variable, otherwise the output is ambiguous. Needless to say, on the code:
#Coding:utf-8" ""Created on 2013-7-9 @author: Hulda" " fromDjangoImportTemplate Register=template. Library () @register. Inclusion_tag ('dlb.djhtml') defDLB ():" "' Double left brace: Two open curly braces, mainly to resolve the problem of the Django server-side template label and the Angularjs Client template label conflict" " return{} @register. Inclusion_tag ('drb.djhtml') defDRB ():" "' Double right brace: Two closing curly braces, mainly to resolve the problem of the Django server-side template label and the Angularjs Client template label conflict" " return{"DRB":"}}"}
Summary: Frankly, this kind of server-side solution, compared to the client settings may be slightly less performance, but the Web site in the performance of the problem, the team optimization capability estimation should not be a problem.
How to troubleshoot Django and angular.js template label conflicts