Hey guys,
I am currently struggeling with some basic Observable handling.
First of all, I am fetching a complex JSON structure, just like in the Working with REST APIs
Tutorial.
This is working just like it should.
I am fetching the data and assign it to my data variable, which is an Observable:
API.getPois().then(function(newContent){
var tmp = [];
tmp.push(newContent);
data.replaceAll(tmp);
The structure of my JSON data looks like this:
{"poi":[{"id":"1","title":"TITLE OF MY POI","city":"CITY OF MY POI""latitude":"LATITUDE OF MY POI","longitude":"LONGITUDE OF MY POI"}]}
....
In my UX-File, I each through my Observable, which is also working perfectly:
<Each Items="{data.poi}">
....
</Each
Initial I was going to sort my array by using the Array.Sort() function, which was only working with a copy of my array, not with the original array.
So I experimented a bit with my Observable and found a strange behaviour which I hope you can help me get rid of:
As I mentioned, the stuff above is working perfectly.
But if I change my Observable after the stuff above, my UX is not responding to it.
If I, for example, change the title of my first entry:
data.value.poi[1].title = "another title";
my UX is not changing the title.
It is still displaying the old title but even if I, afterwards, log my change to the console console.log(data.value.poi[1].title);
, the log is showing the correct change.
I even tried to erase the whole Observable with .clear()
didn’t change anything.
What am I doing wrong here?