26 lines
515 B
Go
26 lines
515 B
Go
package site
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
datastar "github.com/starfederation/datastar/sdk/go"
|
|
)
|
|
|
|
func setupExamplesModelBinding(examplesRouter chi.Router) error {
|
|
examplesRouter.Get("/model_binding/data", func(w http.ResponseWriter, r *http.Request) {
|
|
sse := datastar.NewSSE(w, r)
|
|
|
|
signals := &ModelBindingSignals{
|
|
BindText: "foo",
|
|
BindNumber: 42,
|
|
BindSelection: 1,
|
|
BindBool: true,
|
|
}
|
|
|
|
sse.MergeFragmentTempl(ModelBindingView(7, signals))
|
|
})
|
|
|
|
return nil
|
|
}
|