For example
function Model(){};
var model = new Model();
ko.applyBinding(model);
model.name = ko.observable('john');
I know the code will not work but is it possible to make it work ?
I was able to accomplish this by using cleanNode and then reapplying the bindings.
function Model(){};
var model = new Model();
ko.applyBindings(model);
model.name = ko.observable('john');
var myDiv = $('#myDiv')[0];
ko.cleanNode(myDiv);
ko.applyBindings(model, myDiv);
<div id="myDiv">
<span data-bind="text: name"></span>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With