What's going on here is that both ClientLoad.FromDocument and .Bind() were designed to be used on the main template file (so your Layout), but not on a snippet file (such as your Home). So yeah, there are discrepancies when you try to do that.

One thing that we could do to alleviate this is remove the restriction that .Bind() and keepUnfilled are only generated if ClientLoad is FromDocument. This would allow your project to work correctly by just removing FromDocument from HomeTemplate. Of course this also means that RegionTemplate will be compiled into the JavaScript source, rather than dynamically loaded, so you would need to recompile your project whenever you change Home.html.

Making this project work as-is is a bigger undertaking. What happens is that the server-side template preprocesses ws-templates and, if ClientLoad is FromDocument, inserts them at the end of the <body> in a hidden <div>, so that the client can find them and load them. But this can't be done if said template doesn't have a <body>, so the client doesn't find it. That's why the ws-template from Home.html isn't found on the client side. We're discussing how to make this possible with @granicz, but we haven't found a good way forward yet.

By on 10/31/2018 9:05 AM ()

Thanks for your detailed explanation!

By on 11/1/2018 3:21 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper