Ionic - List update reflect in UI

#1

Hi!

I have been working on app and a got some problems… the biggest is when I run the app the data isn’t loaded from the server, and I show a blank list to the user. When I get the data, I can’t update the list.

My provider has the code:

requestItems() {
  var sr = new Server();
           ......
           this.http.post(sr.url()+'/get',datapost).map(res => res.json()).subscribe(data => {
           ..........
}

but before the request fill the data, in home.ts the code is:

this.MyProvider.requestItems();
this.items = this.MyProvider.getItems();

and the code above get null items…

is there a way to wait for the items? (a subscribe??)

#2

Please put the entire code for MyProvider.

#3

Hi @gedarufi!! I solved using Subscribe. Thank you