The JavaScript interop portion of the guide will probably help, if you
haven't seen it. https://guide.elm-lang.org/interop/javascript.html
Summary: you probably want a port (if the data changes and you want to
handle that in JS-land) or a flag (if you want to pass the data in
initially and have Elm request updates.)
Side note: why are you using backtick-quoted strings in your Go? That's
pretty unusual.
On Tuesday, February 21, 2017 at 2:49:45 PM UTC-6, Kiswono Prayogo wrote:
>
> Hi, i have a backend service that I wrote in Golang, something like this:
>
> func PageA_RequestHandler(ctx *W.Context) {
> // init things
> if is_ajax {
> // handle the API request, render the JSON
> return
> }
> // query the initial rows
> values := M.SX{
> `rows`: model1.GetRows(10),
> }
> // render the html
> ctx.Render(`page_a_template`,values)
> }
>
> then the template file `page_a_template.html` (that loaded at the first
> time it rendered), is a html file, with content something like this:
>
> <div id="grid"></div>
> <script>
> var rows = {/* rows */};
> new GridBuilder('grid',rows);
> </script>
>
> Where's:
>
> {/* rows */} is my javascript-friendly template syntax, there are some
> other syntax like: [/* foo */] or /*! bar */ or #{yay}
> new GridBuilder is my custom javascript component that creates something
> like datatables.net or editablegrid.net
>
> The question is, if I use Elm, what's the correct way to inject the {/*
> rows */} into the compiled html?
>
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.