[Fixed]-Can't print double braces ({{) into browser side

1๐Ÿ‘

โœ…

You can use a {% verbatim %} template block to prevent that Django parses that part of the template:

{% verbatim %}data-ng-href="#{{rc.prepareUrlParam(metric_group.title)}}" {% endverbatim %}

Alternatively, you can use the {% templatetag %} template tag to output the literal {{ and }}:

data-ng-href="#{% templatetag openvariable %}rc.prepareUrlParam(metric_group.title){% templatetag closevariable %}" 

Both methods allow you to output a literal {{ or }} from a Django template, which can then be parsed and handled by AngularJS.

๐Ÿ‘คknbk

0๐Ÿ‘

You need to double the braces {{ or }} to output a single brace { or }. Can you try doing this:

#{{{{rc.prepareUrlParam(metric_group.title)}}}}"

Check this out:

>>> x = " {{ Hello }} {0} "
>>> print x.format(42)
' { Hello } 42 '

Leave a comment