@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