开发者

applyBindingsToNode and html bounds

开发者 https://www.devze.com 2023-03-23 00:50 出处:网络
I am wanting to update a view dynamically by applying applyBindingsToNode to it but it seems it must have a data-bind attached to it?Is that true?What if I have a button and another but开发者_运维百科

I am wanting to update a view dynamically by applying applyBindingsToNode to it but it seems it must have a data-bind attached to it? Is that true? What if I have a button and another but开发者_运维百科ton with click events that needed to be registed by knockout.js. Would I have to call applyBindingsToNode to both of the buttons?

ko.applyBindingsToNode(element1, null, app.viewModel);
ko.applyBindingsToNode(element2, null, app.viewModel);


You can call ko.applyBindings(viewModel, element) on a parent element and it will apply bindings to it and anything under it.

0

精彩评论

暂无评论...
验证码 换一张
取 消