My problem is that when i call a function who listen to the event onBeforeUnload(), i want to post a data with a httpClient request. The problem is that my request is not sent. Here the code
@HostListener('window:beforeunload', ['$event'])
onBeforeUnload(): void {
this._httpClient.post(`${localhost:8080/apiRest}`, infoIWantToSent).subscribe();
}
I don't know if this is the good way to follow. Thank you in advance for your answer.