angular.js - How to output curly braces through django template?
给我你的怀抱
给我你的怀抱 2017-05-15 16:49:42
0
1
787

It’s a bit of a silly question, and I suddenly realized that I don’t know how to do it. Django wants to output something like "{{}}" for angularjs to use

I tried some escaping methods but to no avail. By the way, because these curly braces are for angularjs, you cannot use html to escape characters, like this:


{{ 内容内容 }}

That’s not possible....

给我你的怀抱
给我你的怀抱

reply all(1)
我想大声告诉你

Ask and answer your own questions...I think I found the answer

Escape in this way in django

openblock {%
closeblock %}
openvariable {{
closevariable }}
openbrace {
closebrace }
opencomment {#
closecomment #}

Like here


{% templatetag openblock %} 内容内容 {% templatetag closeblock %}

will be output

{{content content}} This is a django template that does not treat "content content" as a variable

There is another way to modify the angular separator, which is even cooler!

var customInterpolationApp = angular.module('customInterpolationApp', []);

customInterpolationApp.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
});

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template