I have a ViewModel containing the following observable:
self.obFoo = ko.observable({
foo: ko.observable(""),
bar: ko.observable("")
});
Now I want to add a new computed observable to obFoo that depends on both foo and bar, something like this:
self.obFoo = ko.observable({
foo: ko.observable(""),
bar: ko.observable(""),
foobar: ko.computed(function(){
return foo() + bar();
})
});
The problem is that foo and bar are not defined within the scope of foobar. I tried adding 'this' or even 'self.obFoo' as a second parameter to the computed but neither worked.
Is there a way to get the right scope into the computed foobar?