title: TS2304: Cannot find name 'Router'
body: <p>I'm having some trouble redirecting to a certain page in my Angular 2 Ionic app. I have followed the following example: <a href="https://embed.plnkr.co/?show=preview" rel="nofollow noreferrer">https://embed.plnkr.co/?show=preview</a> . Yet I cannot seem to get it working as I keep getting this error: 'TS2304 Cannot find name 'Router''</p>
  
  <p>My IDE shows the error on the 'Router' keyword in the constructor() line 12.</p>
  
  <p>My code:</p>
  
  <pre><code>import {Component} from '@angular/core';
  import 'rxjs/Rx';
  import {BackandService} from '@backand/angular2-sdk';
  import { Router } from '@angular/router';
  
  @Component({
    templateUrl: 'user_auth.html',
    selector: 'page-user-auth',
  })
  export class UserAuthPage {
  
    constructor(private backand: BackandService, public router: Router) {
      this.backand.user.getUserDetails().then(
        (res: any) =&gt; {
          if (res.data) {
            console.log(res.data);
            this.router.navigate('/login');
          }
        },
        (err: any) =&gt; {
          null;
        }
      );
    }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance.</p>
  
  <p>EDIT: Too late I realized; if you're working with Ionic framework, you should use the <a href="https://ionicframework.com/docs/api/navigation/NavController/" rel="nofollow noreferrer">Ionic navigation</a> instead of Angular 2 routing. This helped me further eventually.</p>