I have a KnockoutJS moodel containing three variables: A and B which is are both observables, And C which is a computed like this: return A*B.
As you see C is the result A * B. But I want to be able to also alter C from input (this making it a observable and have A to be the result of C divided by B.
To make a bit more sense. A = amount in our currency and B is the exchange rate. C will then be the calculated destination amount. But sometimes the user doesnt know the amount in our currency but does know the destination amount. The amount in our currency needs than to be calculated, rather then being an observable. I want the user to have the flexibility to calculate the one or the other.
You can use read/write computed to achieve this. Here is example:
View Model:
View:
Fiddle