Fetch Data from the table while leaving the page

Hi,

I want to fetch the data from table while leaving the page or component automatically, so I tried of using ngOnDestroy to do that, but ngOnDestroy clears the instance before using that, so can anyone please recommand me how to fetch the data form the table while leaving the page or component.

I’m using angular2+.

Thanks,
Bala

There are no predefined hooks that you can use. You can, however look for native JS hook brought by the browser.

Here on SO I found a related subject https://stackoverflow.com/questions/28627111/how-to-call-a-function-before-leaving-page-with-javascript