I have the following nested struct and I would like to iterate them in a template, in a {{range .Foos}}
tag.
type Foo struct {
Field1, Field2 string
}
type NestedStruct struct {
NestedStructID string
Foos []Foo
}
I'm trying with the following html/template but it can't access the NestedStructID
from NestedStruct
.
{{range .Foos}} { source: '{{.Field1}}', target: '{{.NestedStructID}}' }{{end}}
Is there any way with golang templates to do what I'd like to do?