How do I escape “{{” and “}}” delimiters in Go templates?

Coder1 picture Coder1 · Jul 14, 2013 · Viewed 22.1k times · Source

I’m using AngularJS as the front-end JS library, with Go templates within Revel framework to to generate the markup on the back-end.

But both Go and Angular use {{ and }} for delimiters in their templates. How can I escape them in Go to pass them to AngularJS?

Answer

Mostafa picture Mostafa · Jul 14, 2013
{{"{{"}}
{{"}}"}}

produces

{{
}}