I want to know if it’s possible to only show the next page if the data response from the server is correct.
I’ve noticed that when doing a network request it takes a few seconds to get the data from my server into a observable so if I do the request and immediatly go to the next page the data won’t be available.
Right now I use timeouts to prevent this from happening but this slows down my app with x seconds every time the app makes a network request.
So that depends on what getData is. Since you’re setting the value property on it, I assume its an Observable but then you have _values so not too sure.
Anyways I think there may be one of two possible things causing this:
Which depending on how you manipulate this in your goToNextPage function you can just do setTimeout(goToNextPage, 3000); since you’re not passing anything to the function
The other possible thing, is your server code (which that I can’t help from this)
Where data is the JSON string. This is why i use _values.
My code works fine but my question was if there is another way to fill my Observable with the JSON result without using the timeout because right now if I remove the timeout userdata will be undefined.
Judging from your answer can I asume that timeouts is the only way to do this or am I wrong?