This is a creation in Article, where the information may have evolved or changed.
Good-looking please "top"
The IF variable in the range in the 1.//golang template does not work
Template: {{range. Rooms}} {{if. Part1}} <div class= "box span1" ><a href= "/org/{{. orgid}}/room/{{. Setid}}/do "target=" _blank "> View </a> </div> {end}} {{end}}" background Code: renderhtml (W, "Roomlist", map [string]interface{}{ "Part1": Part1,//part1,bool type (true) "rooms": Roomdb,//roomdb,struc type})
&: note {{if $Part 1}}{{end}} If there are other variables that are not written in the range are defined in advance, otherwise the contents of {{if $Part 1}}{{end}} will not be displayed
{{$Part 1: =. Part1}}{{range. Rooms}} {{if $Part 1}} ... {{End}} {{End}}
2.//template. (*escaper). Escapetemplatebody,template. (*template). Escape error, when the background code is correct, and can not find the reason
&: See if template labels are all closed, especially <script>