I have two structs as below and I need to render the data on a template using the templates pack. I get this error
<.Email>: Email is not a field of struct type Notes
.
The issue seems to be that only fields of the range struct seem to be available within the range loop so I'm wondering how I can import fields from outside the range struct (e.g. the Email string).
The behavior is quite unexpected.
type notes struct{
Note string
sf string
}
type uis struct{
notes []Note
Email string
}
var ui uis
HTML
{{range .notes}}
{{.Email}} {{.sf}}
{{end}}
Email {{.Email}}
I've checked the godocs but they seem quite useless.