Hej fuse,
Another noob Observable question, I’m afraid. I’m getting my head around using Observables better, but have been stuck on this for a little while. I’m trying to concatenate the values of several observables, but the concatenation doesn’t seem to update in the UX (I can get it to in console?).
Here if we change the Obs1 to say, 12, the {concat} doesn’t update. I’ve tried a lot of variations such as wrapping the entire concat as a variable, and trying to log out the values but can’t seem to find the solution. Any help muchly appreciated
<App>
<JavaScript>
var Observable = require("FuseJS/Observable");
var Obs1 = Observable(1);
var Obs2 = Observable(2);
var concat = Obs1.value + Obs2.value;
Obs1.onValueChanged(module, function(item) {
var concat = Obs1.value + Obs2.value;
});
module.exports = {
Obs1: Obs1,
Obs2: Obs2,
concat: concat
};
</JavaScript>
<ClientPanel>
<StackPanel>
<TextView Value="{Obs1}" />
<TextView Value="{Obs2}" />
<TextView Value="{concat}" />
</StackPanel>
</ClientPanel>
</App>