title: In angular 2 how do you detect route changes
body: <p>This is my current attempt using the old libraries.</p>
  
  <p><strong>I'm now using the latest libs, how would I update this:</strong></p>
  
  <pre><code>import { Component,  } from '@angular/core';
  import { Location } from '@angular/common';
  import { Router } from '@angular/router';
  
  @Component({
    moduleId: module.id,
    selector: 'HeaderComponent',
    templateUrl: 'header.component.html'
  })
  
  export class HeaderComponent{
    router : Router;
  
    constructor(router: Router, location: Location){   
        this.router = router;
  
        this.router.changes.subscribe((currentRoute) =&gt; {
            let currentRoute = this.location.path();          
        })
    }
  }
  </code></pre>
  
  <p><strong>This is my module:</strong></p>
  
  <pre><code>export * from './header.component';
  
  import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { RouterModule } from '@angular/router';
  
  import { HeaderComponent } from './header.component';
  
  @NgModule({
    imports: [RouterModule, CommonModule],
    declarations: [HeaderComponent],
    exports: [HeaderComponent],
    providers: []
  })
  
  export class HeaderModule { }
  </code></pre>