I have several HTML pages which I transform into blocks HTML in order to inject them in my main container. However, I have to use the knockout binding because ko.applyBindings (viewModel)
.
Does not work anymore if i change with jQuery $('container').html(...)
?
Here is my code:
var viewModel = {
appView: {
Html: ko.observableArray()
}
}
this.loadHtmlToPage = function (htmlblock) {
var contentPage = function (status) {
this.chain = ko.observable(status);
}
viewModel.appView.Html.push(new contentPage(htmlblock));
}
<div id="container" data-bind="html: chain"></div>