I want to bind the dynamic HTML with knockout. here I attached two images for references.
in first Image I am going to data-bind with knockout. there is json object coming from the asp.net webservice Json format. after that When I click on the '+' icon then I am added html template inject after the '+' item div, and then bind that data with new json request.
first, I bind the ko.Applybindigs() with whole data list with one Viewmodel and same view model not working for newly injected Html elements..
On ready evennt I doing binding.
$(document).ready(function(){
var ViewModel = function () {
var self = this;
self.result = ko.observableArray('');
self.newresult = ko.observableArray('');
};
var vmLab = new ViewModel();
ko.applyBindings(vmLab);
});
after new HTML elements injecting on '+' icon click event. then trying to add array of json objects in "newresult" observalbe array.. but it getting error. "Error You cannot apply bindings multiple times to the same element"
How I can achieve this by knockout .. some Html added from the jquery and bind same view model.. please suggest me or give alternate solution.