Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to nest IPagelet inside Doc #18

Open
endeavour opened this issue Dec 11, 2014 · 1 comment
Open

Ability to nest IPagelet inside Doc #18

endeavour opened this issue Dec 11, 2014 · 1 comment

Comments

@endeavour
Copy link

AsPagelet() allows conversion of UI Next to pagelet but there seems to be no page to nest pagelets inside UI Next.

Doc.Static(myPagelet.Body) doesn't quite work because .Render() never gets called on the pagelet.

@qwe2
Copy link
Contributor

qwe2 commented Apr 27, 2015

I am a bit late here but for future reference you can use something like this to get around the limitation:

let embedPagelet (pagelet : WebSharper.Html.Client.Element) =
    pagelet.Dom
    |> View.Const
    |> View.Map (fun el ->
        pagelet.Render ()
        Doc.Static el)
    |> Doc.EmbedView

The trick is to execute the Render () side-effect inside the View.Map so it will be called each time the element is inserted into the DOM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants