I wrote a custom binding that is generic. It will set any attribute.
In my case, I'm using it to set the src of an image, so I'd use it
like this:
<img data-bind("attr: image_source, name:'src'")
ko.bindingHandlers.attr = {
update: (element, valueAccessor, allBindings) ->
$(element).attr(allBindings().name, valueAccessor())
}
If there's a better way to do that, please let me know. If not,
perhaps it could be included in a future release?