Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Call function after data retrieved in provider in Ionic2

$
0
0

@shepard wrote:

How do you call a function after data is retrieved from a provider?

I am able to call a function if I pass it in the function in the provider like:
retrieveData(func) {
this.http.get("./something.json")
.map(res => res.json())
.subscribe(data => {
func(this.data);
});
}

'func' is passed like so:
func(){
dosomething
}
this.someProvider.retrieveData(this.func)

But this does not seem to be the way I am supposed to do it. Right?
Again, I am trying to call a function after the data is retrieved.
So, not just: somedata = this.someProvider.retrieveData());

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>