Created
December 1, 2014 19:40
-
-
Save osbornm/8d24d9e1cad036ac4895 to your computer and use it in GitHub Desktop.
KnockoutJs href binding
This file contains hidden or 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.href = { | |
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { | |
return ko.bindingHandlers['attr']['update'](element, function () { | |
return { href: valueAccessor() }; | |
}, allBindings, viewModel, bindingContext); | |
} | |
} |
This file contains hidden or 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
<a data-bind="href: hrefPropertyOnObject"></a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment