码迷,mamicode.com
首页 > Web开发 > 详细

angular js 和 dajango 标签{{}} 冲突

时间:2016-10-19 01:58:57      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:

问题描述:

如果在django的模板中使用{{ }},不会被angularjs 识别。

 

解决办法:

>1.5 的django中,将需要angularjs解释的{{expression}}放在 verbatim模板标签中

{% verbatim %}

{{ vm.name }}

{% endverbatim %}

 

注意:

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)

参考:http://stackoverflow.com/questions/8302928/angularjs-with-django-conflicting-template-tags

{% verbatim %}


{{if dying}}Still alive.{{/if}}{% endverbatim %}

angular js 和 dajango 标签{{}} 冲突

标签:

原文地址:http://www.cnblogs.com/ifykwf/p/5975281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!