Skip to content

Instantly share code, notes, and snippets.

@EyePulp
Created August 20, 2013 20:06
Show Gist options
  • Save EyePulp/6286546 to your computer and use it in GitHub Desktop.
Save EyePulp/6286546 to your computer and use it in GitHub Desktop.
Simple KO binding for getting context data from within a VM
ko.bindingHandlers.console = {
init: function (element, valueAccessor,allBindingsAccessor) {
console.info('ko.console:',valueAccessor());
},
update: function (element, valueAccessor, allBindingsAccessor) {
console.info('ko.console:',valueAccessor());
}
};
<div data-bind="console: $parent.foo()"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment