我想做一个弹出框(引导程序)自定义绑定。
我已经这样定义了:
ko.bindingHandlers.popover = {
update: function (element, valueAccessor)
{
var template = ko.unwrap(valueAccessor);
$(element).popover({
placement: 'top',
html: true,
content: 'text!' + template() <---- How can i get html into here?
});
}
};
<button data-bind="popover: 'templates/mytemplate.html'">
PopOver
</button>
问题是,我不确定如何注入我想要的 html。自然我想要一个模板路径来解决,但使用需要文本!插件没有我希望的那么好。
我怀疑我忽略了一些更简单的东西?