knockout.jsicanhaz.js

Using ICanHaz.js and knockout.js on the same page


I have an app where knockout.js is used to deliver most of the site functions, but I want to use ICanHaz.js for a specific feature. Both of these frameworks use <script type='text/html'... /> sections to define templates. However ICanHaz processes the templates (to create javascript functions to render the templates), then deletes them from the dom so they're not available for knockout to bind to later in the page lifecycle.

Anyone know of a way to get these two frameworks to play nicely?


Solution

  • Knockout doesn't care what the type is on the script tag, so you can really make it anything other than text/javascript. If ICanHaz.js is looking for text/html, then you can use text/ko on your Knockout templates.