This one has me scratching my head. I am building a menu app to sit on my shop counter so customers can browse when I am busy. I need to redirect all pages to the main start page when there has been no activity on the app for 5 minutes.
I have the redirect working on a page with the following code in my ts file (short timeout just for testing).
I am struggling to find a way to clear the timeout when a user navigates away from the page. Everything I do seems to be either throwing an error or just not working. Any ideas? Or is there a better way of achieving this?
ngOnInit() {
setTimeout(() => {
this.router.navigate([‘start’]);
}, 10000); //5s
}