Am I missing anything, or is it simply not possible to declare a computed "inline" property like id_and_name
below in my first example?
function viewmodel(){
var self = this;
// adding 'inline' won't work (exception that the functions doesn't exist):
self.person = ko.observable({
id: ko.observable(),
name: ko.observable(),
id_and_name: ko.computed(function(){ return this.id() + this.name(); }, self.person)
});
// this works:
self.person.id_and_name = ko.computed(function(){
return this.id() + this.name();
}, self.person);
}