0

我在我的网站上使用了一个警报插件。该警报提示用户选择多个选项中的一个。像图像的东西。在此处输入图像描述

问题是按钮是这样动态生成的

var html = "<div id='reject-options'></br> ";
html += "<a href='#' class='button alert small radius' data-bind='click: $root.blacklistOrderForMatch'>" + Texts.Order + "</a> </br>";

点击绑定不适用,因为在网站加载时绑定已经到位。我怎样才能做到这一点?期待着听到您的意见。

4

1 回答 1

4

你只需要使用:

ko.applyBindings(self, document.getElementById('reject-options'));
//self is your view model

小提琴

第二个参数ko.applyBindings是要应用绑定的节点。

于 2015-10-06T10:42:53.470 回答