I'm new to Angular, I'm using bn-ng-idle for session timeout, it is working fine however, when I put the code in ngOnInit or Constructor, the code keeps repeating over and over although I'm not even in the same page, so when I enter the employees page and then get routed to signin page the code inside the constructor keeps repeating for some reason, appreciate your help.
employee.component.ts
constructor(private bnIdle: BnNgIdleService, private router: Router){
this.bnIdle.startWatching(5).subscribe((isTimedOut: boolean) => {
if (isTimedOut) {
this.router.navigate(['/signin']);
console.log('session expired');
}
return;
});
}