rniemeyer / knockout-classBindingProvider

An alternate binding provider for Knockout that allows you to define your bindings in a JavaScript object and key into it from the markup.
MIT License
101 stars 27 forks source link

Unwrapping observables #24

Closed christo8989 closed 8 years ago

christo8989 commented 8 years ago

I'm creating a custom binding and trying to unwrap the observables that are being returned.

I realize that I could setup the object to take the value instead of the observable, but I don't think it should be necessary to do that.

var bindings = {
    value: ko.observable('some value'),
};

ko.bindingHandler.custom = function () {
    init: function (element, valueAccessor, allBindings, viewmodel, bindingContext) {
        var option = ko.unwrap(valueAccessor().value);
    },
};

This is a super basic example of what I'm trying to do.

christo8989 commented 8 years ago

Nvm. My code was doing something unexpected.