I am building an Angular2 application.
I have an asynchronous function deleteObject
in myService
. It returns a Promise. I have another function in the Component called refresh
, which refreshes the page. How do I call refresh from inside the Promise. This is what I tried:
export class AppComponent{
refresh(){
// refresh page here
}
delete(){
this.myService.deleteObject(params).then(
function(data){
//this.refresh() doesn't work here.
});
}
}