Mark an option as selected - golang

Good afternoon

I can not mark option as selected,

Cod…

{{range $k, $group := .groups}}
<option value=".Id" {{if eq .Id .categorys.Group}}selected{{end}}>.Name
{{end}}

When I pass the “if” nothing else appears after
Can anybody help me?

What is the error that the server returns?

Notice that unless you need $k and $group you can just do:

{{range .Groups}}
{{end}}

Try in your Go code:

s := struct{}{} // replace struct{}{} with the the struct you pass in your template
fmt.Println(s.ID == s.categories.Group)

If the above doesn’t print true then check the individual values.

Thanks!!

Problem solved using ajax on return to template