Is there an easy way to use data-bind=\"textInput: aProperty\"
and add an input mask or some automatic formatting as the user types?
Using the mask
I've written a fiddle that uses just a computed observable, and I don't have a focus problem with it. Does this work as you expect?
var displayString = ko.observable('');
var formattedString = ko.computed({
read: function () {
return displayString();
},
write: function (newValue) {
var f = format(newValue);
console.debug("Format", newValue, "=", f);
displayString(f);
}
});
http://jsfiddle.net/csmmnq25/