我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Golang Iris框架在范围内渲染

I'm trying to loop over items and render it in separate template, but {{ . }} in item.html contains root variables instead of a single item. I tried to assign item to a variable {{ range $i, $item := .Items }}, but the result is the same.

<!-- list.html -->
{{ range .Items }}
    {{ . }} this one is OK
    {{ render "item.html" }}
{{ end }}

<!-- item.html -->
{{ . }} this one is not

近期文章

  • Golang模板-在范围循环内将模板变量用作全局变量
  • 运行已编译的golang脚本时出错
  • 在Golang中解析有问题的JSON文件的最佳方法
  • 如何在Golang中使用原子的加载和存储
  • 转到模板“系统找不到指定的路径”
  • Intellij上的Golang插件。 库和断点
  • 如何绑定查询字符串?
  • 通过Nginx用goapp提供静态文件时出现问题
  • 导入“ github.com/sparrc/go-ping”库时出现詹金斯错误
  • 谷歌云BigQuery未定义ValueList
  • Twitter oauth golang收到错误“代码”:32,“消息”:“无法验证您的身份。”
  • 省略号的所有用途
  • 如何正确清理带有大量发送的Go通道
  • HDFS排除AddblockRequestProto中的数据节点
  • 在Heroku中使用本地软件包的Revel应用
  • sensulib包接口作为函数参数
  • 无法访问在另一个函数中更改的结构字段
  • 进入IRIS http框架,我无法正确路由
  • 杜松子酒拦截请求正文
  • 如何在Go中合并任意数据结构?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华