在angularjs中字符串解释不正确

I have a string in golang as follows.

discount = "("+discount+"% off)"

when passed to html via angularjs it is displayed as follows (10 %o(MISSING)ff)

Any idea why it is happening? Thanks in advance.

Something in your HTML rendering process is passing the string through go's fmt.Sprintf or similar. Try escaping the % by doubling it:

discount = "("+discount+"%% off)"

See http://play.golang.org/p/S_GEJXSfnD for a live example.

Looks like you need to escape the string. Try to use this module: http://golang.org/pkg/html/