I am trying to use "virtual element" with html binding to create html part on the fly but failed with message: "The binding 'html' cannot be used with virtual elements". Here is the jsfiddle: http://jsfiddle.net/d3Dpp/.
Anyone knows if there is any workaround?
You could also use this as your view:
This will replace the innerHtml of the div "container" with your provided html property.
Based on Artem's code and KnockoutJS 2.2.1, here's an improved version:
http://jsfiddle.net/YZzDe/2/
Improvements:
Here's the code
Well, after some playing with knockout I see that it is possible.
Working example is here
http://jsfiddle.net/d3Dpp/42/
unfortunatelly this requires duplication of some internal knockout functionality
UPDATE
KnockoutJS 2.2.1 added virtual elements binding to export, so it is available even in minified version:
It means that better solution for html binding is possible - see Martijn's answer.