I have 2 viewmodels, 1 have an observable and the second have a ko.computed that refer to the other model. I need to refresh my computed value when the first viewmodel observable is updated.
var viewModel1 = {
value: ko.observable(1)
}
var viewModel2 = {
result: ko.computed(function() {
if (viewModel1.value() > 2) {
return "xxx";
}
return "yyy";
});
}
how can I subscribe with "result" to "value" in the other model?