custom binding example
by Richard Hunter
HTML
<h1>Custom bindings example</h1>
<div data-bind="mycustom: { foo : 'foo'}, anotherCustom : { bar : 'bar'}"></div>
JavaScript
var model = {
dizzy : "it's just that mean ol' Texas sun.."
};
ko.bindingHandlers.mycustom = {
init : function (element, valueAccessor, allBindings, viewModel, bindingContext) {
var config = valueAccessor();
console.log(bindingContext);
}
}
ko.bindingHandlers.anotherCustom = {
init : function () {
}
}
ko.applyBindings(model);