0

I am adding some simple html when the user clicks a table row. The table row gets "expanded" and the the html is added via the knockout html binding.

The html being injected to the view works fine, but I have added data-bind to some of the html and would like for knockout to parse/process it. Is this possible?

4

1 回答 1

1

After you add the HTML, call apply bindings again but restrict what HTML you're looking at to just the newly-added HTML, like so:

ko.applyBindings(viewModel, $("#new-html")[0]);
于 2013-05-09T14:43:52.923 回答