0

On my page I have a several nested KnockoutJS view models applied to several logic-rich markup regions.

From within my FactViewModel I am loading a div with a list of comments to that "Fact". This is taking place via a click handler in FactViewModel. The ajax-loaded markup contains data-bind attributes but as expected there are not bound to the viewmodel elemets. How do I extend the view model to a dynamically loaded markup to process, for example, a click handlers, etc.

1 Answer 1

0

You should take a look at Knockout's templating.

http://knockoutjs.com/documentation/template-binding.html

You want to define a client side template, either included as a fixed part of your initial HTML, or load and attach it to the document dynamically. You don't really post any code, so it's hard to post any specifics, but I make use of KOs templates, and I feel they work quite well (and yes, I also apply them to dynamically loaded data).

1
  • Thats the way. Thank you. I didn't post code since I needed a purely theoretical guidance on the matter. Sep 19, 2012 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.