Open stephenhu opened 8 years ago
there's a workaround which is to assign the page level variable to a variable:
e.g.
$id = ID
each $i in Bar h3 #{$i} // works fine h3 #{$id} // this works
i would say this is a fairly serious limitation, seems nested loops or nested maps also have the same issue and the work around is not very apparent to me at the moment.
if i pass a struct into an amber template, i can't seem to access the variables inside of an iteration block:
let's say i have this struct:
type Foo struct { ID string OK bool Bar []string }
// initialized here f = Foo{ID: "abc", OK: true, Bar: make([]string){"ddd", "eee"}}
passed into the template.Execute function:
template.Execute(w, f)
i can do the following without any issues: h3 #{ID} // h3 abc
but if i do this:
each $i in Bar h3 #{$i} // works fine h3 #{ID} // causes an Amber Error <>: Unable to parse expression
exact error is: Amber Error in <static/templates/viewteam.amber>: Unable to parse expression. - Line: 62, Column: 21, Length: 2