Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow binding template holes to the document #161
It would be nice to be able to fill holes directly into the document on the client side. For example instead of having to do something like this:
<div id="main" ws-children-template="main"> <button ws-onclick="Click">Click me</button> </div>
[<SPAEntryPoint>] let Main() = Template.main() .Click(fun e -> ()) .Doc() |> Doc.RunById "main"
we would be able to do this:
<div id="main"> <button ws-onclick="Click">Click me</button> </div>
[<SPAEntryPoint>] let Main() = Template() .Click(fun e -> ()) .Bind()
and no elements would be removed and re-rendered, instead the event handler would be added directly to the document.
added a commit
Mar 22, 2018
I have a working implementation for SPAs. A question now is what to do when the page is served from a sitelet. The server-side templating will have purged all holes from the page, so there is nothing left to bind on the client side. The simplest solution is probably to add an option for server-side templates to not purge holes. There are two possibilities for this:
I believe solution 2 is better, as it leaves the possibility to instantiate the same template in different sitelet endpoints, some of which use client-side