0

在我的页面上,我有几个嵌套的 KnockoutJS 视图模型应用于多个逻辑丰富的标记区域。

在我的内部,FactViewModel我正在加载一个包含对该“事实”的评论列表的 div。这是通过FactViewModel. ajax 加载的标记包含data-bind属性,但正如预期的那样,没有绑定到视图模型元素。如何将视图模型扩展到动态加载的标记以进行处理,例如单击处理程序等。

4

1 回答 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).

于 2012-09-19T11:10:58.197 回答