Comment in Dynamic HTML not honored
HTML
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<input type='checkbox' data-bind="checked:showCheck"/>Show
<div id='fixture1'>
</div>
<div id='fixture2'>
</div>
CoffeeScript
class MyClass
constructor: ->
@showCheck = ko.observable(false)
loadContent: (onloaded)=>
content1 = "<!--ko if: showCheck -->fixture 1 is here<!-- /ko -->"
content2 = "<div data-bind='if: showCheck'>fixture 2 is here</div>"
debugger
$('#fixture1').append(content1)
ko.applyBindings(@,$('#fixture1')[0])
$('#fixture2').append(content2)
ko.applyBindings(@,$('#fixture2')[0])
onloaded() if onloaded?
window.thisClass = new MyClass()
ko.applyBindings(window.thisClass)
setTimeout =>
window.thisClass.loadContent =>
$('body').append('loaded!')
, 1000