From 51cbe818b498b8b4a43fdf74eb2364a6876017df Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Fri, 26 May 2017 16:28:38 +0200 Subject: [PATCH] Html ora dinamico --- html.go | 6 +++++- template/Interfaccia.html | 31 +++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/html.go b/html.go index 2485590..a0a2e1b 100644 --- a/html.go +++ b/html.go @@ -16,5 +16,9 @@ func handlerRoot(w http.ResponseWriter, r *http.Request) { if err != nil { panic(err.Error()) } - templ.Execute(w, new(interface{})) + varmap := map[string]interface{}{ + "matrice": Matrix, + "tempoAggiorna": Clock, + } + templ.Execute(w, varmap) } diff --git a/template/Interfaccia.html b/template/Interfaccia.html index c0e47bf..42b75ed 100644 --- a/template/Interfaccia.html +++ b/template/Interfaccia.html @@ -1,6 +1,7 @@ GoBug + -

Go bug

- - - - - - - - - - +

Go bug

+
-
+ {{range $riga := .matrice}} + + {{range $cella := $riga}} + + {{ end }} + + {{ end }}
{{ $cella }}