Hey i try to make http request on close tab but its not work, But if i navigate to other component its work. I try to change the function like this post Angular 2 - Execute code when closing window
But its now work for me.
My http service:
removeCurrentEditor(reportID) {
return this.http.request('GET', this.baseUrl + this.REPORTS_API + '/' + this.REMOVE_CURRENT_EDITOR
+ '/' + reportID, {responseType: 'json'});
}
my component:
// Handle close tab
@HostListener('window:beforeunload', ['$event'])
beforeUnloadHander(event) {
this.reportService.removeCurrentEditor(this.reportID);
}
Thanks !