Created
August 20, 2013 20:06
-
-
Save EyePulp/6286546 to your computer and use it in GitHub Desktop.
Simple KO binding for getting context data from within a VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.bindingHandlers.console = { | |
init: function (element, valueAccessor,allBindingsAccessor) { | |
console.info('ko.console:',valueAccessor()); | |
}, | |
update: function (element, valueAccessor, allBindingsAccessor) { | |
console.info('ko.console:',valueAccessor()); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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