I am trying to create a custom binding for twitter boostrap popovers that references a template but I am having trouble with the binding part of the content inside of the po
I adapted another answer here: https://stackoverflow.com/a/16876013/1061602
This works a lot better for me, especially for a simple popover.
ko.bindingHandlers.popover = {
init: function (element, valueAccessor) {
var local = ko.utils.unwrapObservable(valueAccessor()),
options = {};
ko.utils.extend(options, ko.bindingHandlers.popover.options);
ko.utils.extend(options, local);
$(element).popover(options);
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
$(element).popover("destroy");
});
},
options: {
placement: "top"
}
};
Then the binding is:
You can override other options obviously.