Skip to content
Permalink
Browse files

03-Template-Advance combination

  • Loading branch information...
bonfy committed Sep 7, 2018
1 parent 50e5028 commit 134267d02ad558c191387b79afd4b1cb8bcd1622
Showing with 4 additions and 4 deletions.
  1. +2 −2 main.go
  2. +2 −2 templates/index.html
@@ -12,14 +12,14 @@ type User struct {

// Post struct
type Post struct {
User User
User
Body string
}

// IndexViewModel struct
type IndexViewModel struct {
Title string
User User
User
Posts []Post
}

@@ -7,9 +7,9 @@
{{end}}
</head>
<body>
<h1>Hello, {{.User.Username}}!</h1>
<h1>Hello, {{.Username}}!</h1>
{{range .Posts}}
<div><p>{{ .User.Username }} says: <b>{{ .Body }}</b></p></div>
<div><p>{{ .Username }} says: <b>{{ .Body }}</b></p></div>
{{end}}

</body>

0 comments on commit 134267d

Please sign in to comment.
You can’t perform that action at this time.