Dual Bindings for same binder on an element

by tlarson

HTML

<input data-bind="value:o1, value: o2, testBinder: 'foo'"></input>

JavaScript

ko.bindingHandlers.testBinder = { 
    init: function(element, valueAccessor, allBindingsAccessor) {
    
        element.o3 = ko.observable();
    	ko.applyBindingsToNode(element, {
	    	value: element.o3
    	});
        element.o3.subscribe(function(newValue) {
            console.log("o3 new value: " + newValue);
        });

    }
}
        
var ViewModel = function() {
    var self = this;
    self.o1 = ko.observable();
    self.o1.subscribe(function(newValue) {
        console.log("o1 new value: " + newValue);
    });

    self.o2 = ko.observable();
    self.o2.subscribe(function(newValue) {
        console.log("o2 new value: " + newValue);
    });
    	
}


ko.applyBindings(new ViewModel());