Reputation: 560
I have html stored in a table returning as a string, and I want to insert it into my html template. Currently it just renders as a string:
Eg. assume my myHtmlString
var value is <h3>Hello</h3>
func (h *handler) buildEmailTemplate() model.myEmailModel {
return model.myEmailModel {
message: myHtmlString
}
}
type myEmailModel {
message: template.HTML '<h1>Hello</h1>'
}
I've tried changing this buildEmailTemplate function to parse to a template.HTML string unsuccessfully:
message: template.HTML(myHtmlString)
Upvotes: 0
Views: 191
Reputation: 45
Why not to leave <h1> </h1>
in html and pass "hello" or whatever as usual? By default passed argument can be empty string.
Upvotes: 1