Question

I can see the infuser loading the template and setting it in templates observable but the rendering doesn't happen. It just shows 'Loading', however it calls afterRender method. the template is like

<button>Refresh</button>
<nav>
  <ul data-bind='template:externalTemplate,foreach:DataArray,afterRender:callMe'></ul>
</nav>

When the template loads the array already have few observable objects in it. But doesn't get rendered. but if click refresh button and clean and reload the array. it renders alright.

This was working alright with ko 2.2.0 and jquery 1.8... is KoExternalTemplate broken with this update?

EDIT: Steps to reproduce:

  1. Start a new project with HotTowel SPA template (search for this template in google if you dont already have)
  2. Via NuGet add koExternalTemplate, which will install traffic cop and infiser as well.
  3. update BundleConfig.cs to add TrafficCop,infuser and koExternalTemplate
  4. create a folder names Templates under root of the project add a template file. update main js with infuser configs to point to the Templates and file pattern (if you know bit of koExternalTemplate you know what i am talking about).
  5. Include the template in home/details html and launch the app.

Result: you will only see 'Loading...' in place of your template and template doesnt get rendered.

Was it helpful?

Solution

Dhana – The best option is to use Durandal's compose binding with that view. Like this:

<div data-bind="compose: { view: 'templates/_sample.tmpl.html', activate: true }">      
</div>

And move the templates foler under the views folder (convention).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top