How to escape "{{" and "}}" AngularJs delimiters in Go template?

Both AngularJs and Go templates use "{{" and "}}" delimiters, so how to use escape the delimiters in Go templates?

Here are some solutions to try:

1. I use {{ raw "{{it.avatar}}" }}. I recommend this for readable reason.

in HTML attribute:


2. use Delims:

func (t *Template) Delims(left, right string) *Template

In Revel framework, add the line:

template.delimiters = "[[ ]]"

to conf/app.conf


3. Use {{"{{"}} for opening and {{"}}"}} for closing angular expressions

For ex: {{"{{"}}it.avatar{{"}}"}} (AngularJs expression: {{it.avatar}} )


Comments