Since the behavior you want often changes from page to page, this is what I do in my layout / template file (ASP.NET).
<div class="ko-unbound" data-bind="css: { 'ko-unbound': false, 'ko-bound': true }"> @RenderBody() </div>
When the page is linked:
ko-unbound class is removed from the page (the class attribute is initially added). Class added to pageko-bound .
Then on the page where inappropriate content is the problem, I can configure css to show or hide objects based on these two classes. I also use this technique to show a loading image, or possibly impose a minimum height for an element.
.ko-unbound
During testing, when applying the bindings, I add a timeout so that I can see the flash.
setTimeout(function () { ko.applyBindings(RR.VM); }, 300);
Simon_Weaver Feb 08 '15 at 6:22 2015-02-08 06:22
source share