Comments (1)
you can pass complex data struct by prefixing the pipeline by json
type Data struct {
FieldOne string
FieldTwo int
FieldThree []string
}
type Hello struct {
ComplexData map[string]Data
}
func (h *Hello) Render() string {
return `
<div>
<h1>
{{ range $key, $data := .ComplexData }}
<span>{{ $key }}</span>
<World Data="{{ json $data }}"></World>
{{ end }}
</h1>
</div>
`
}
type World struct {
Data Data
}
func (w *World) Render() string {
return `
<span>
<span>FieldOne: {{ .Data.FieldOne }}</span>
<span>FieldTwo: {{ .Data.FieldTwo }}</span>
<span>FieldThree: {{ .Data.FieldThree }}</span>
</span>
`
}
func init() {
app.RegisterComponent(&Hello{})
app.RegisterComponent(&World{})
}
from go-app.
Related Issues (20)
- Access HTML or Body element HOT 5
- how to upload and access a file HOT 5
- user session, log in / log out HOT 6
- Share data hierarchy in Go like event bubble in js HOT 2
- Htmx HOT 1
- How to use marwan-at-work/wasm-fetch module? HOT 2
- SVG HOT 1
- Already Mounted.
- Event listeners disappear HOT 15
- Casting to a specific type or exposing an interface with HTML element functions HOT 12
- Latest onDragStart,onDragLeave example HOT 1
- support hash based routing HOT 2
- `go-app documentation` loading indicator shows percentage greater than 100 HOT 1
- Can't make scrollbar follow new content added to overflow bottom. HOT 7
- Ssr to make the google gods happy HOT 2
- FuncOf return value HOT 2
- debugging terminal errors HOT 6
- problem with page render HOT 3
- [Question] What's the best way to handle form submission data? HOT 29
- Some content double rendering in the browser HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-app.