I try to print the current index of a slice when iterating using the html/template package with Revel but I don't get the expected result.
My action:
func (c App) Index() revel.Result {
test_slice := []string{"t", "e", "s", "t"}
return c.Render(test_slice)
}
My template:
{{range $i, $test_slice := .}}
{{$i}}
{{end}}
Instead of getting 0 1 2 3
,
I get DevMode RunMode currentLocale errors flash test_slice session title
What did I do wrong ?