I'm a newby in ko, but cannot find a solution for my problem. I try to organize my bindable properties into a view-model hierarchy. Based on the documentation it seems to me that the following should work, but it doesn't. Do you have any hints?
function AppViewModel() {
this.nested = new NestedViewModel();
}
function NestedViewModel() {
this.firstName = ko.observable();
this.lastName = "Bertington";
}
ko.applyBindings(new AppViewModel());
and used here:
<p data-bind="with: nested">
<p>First name: <input type="text" data-bind="value: firstName, valueUpdate: afterkeydown"></input></p>
<p>Last name: <strong data-bind="text: firstName"></strong></p>
</p>