【发布时间】:2016-05-27 20:06:50
【问题描述】:
我正在尝试将嵌套结构中的切片传递给 Revel 模板,但出现错误:
7:在<.data.company>处执行“App/Index.html”:company是struct type interface {}
的未导出字段CONTROLLER
type company struct {
Tradetotals float64
Totals float64
CostCount string
TraderCount string
}
type alldata struct {
company []company
}
func (c App) Index() revel.Result {
//etc
//etc
//etc
return c.Render(data)
}
INDEX
{{range $count, $company := .data.company}}
<div>
<button type="submit" class="btn btn-sq-lg btn-danger" name="333" value="2-50000">
<i class="fa fa-user fa-5x"></i><br/>
Demo Danger <br>Button
</button>
<button type="submit" class="btn btn-sq-lg btn-success">
<i class="fa fa-user fa-5x"></i>
US: {{$company.Tradetotals}}<br>{{$company.Totals}}<br>{{$company.Totals}} {{$company.CostCount}}
</button>
</div>
{{end}}
有谁知道如何做到这一点?任何帮助,将不胜感激!谢谢你。
【问题讨论】: