首页 > 代码库 > angular js 和 dajango 标签{{}} 冲突
angular js 和 dajango 标签{{}} 冲突
问题描述:
如果在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 标签{{}} 冲突
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。