title: Angular 4 redirect after inactivity
body: <p>I need to make a timeout whenever you are inactive on a page. Lets say you are 20 seconds on a page without clicking something it will redirect you to the home screen. </p>
  
  <p>The current code does not work for inactivity and i dont know how to make it work. </p>
  
  <pre><code>ngOnInit() {
  // do init at here for current route.
  
  setTimeout((router: Router) =&gt; {
      this.router.navigate(['nextRoute']);
  }, 20000);  //20s
  </code></pre>
  
  <p>}</p>