Answer the question
In order to leave comments, you need to log in
How to pass two structures to a template?
I pass one structure to the template:
How can I pass two? something like this:
What would be called in the template already by parameters:
{{.products.Item}} and, accordingly {{.products2.Item}} ExecuteTemplate(w, "single", products)
ExecuteTemplate(w, "single", products, products2)
Answer the question
In order to leave comments, you need to log in
type C struct {
Products T1
Products2 T2
}
var c C
Execute(w, c)
What would be called in the template already by parameters:
{{.products.Item}} and, accordingly, {{.products2.Item}}
.Products2.Item
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question