title: Angular2 - browser_adapter.ts ORIGINAL EXCEPTION: No provider for Location
body: <p>this is a quick question.. but I wish to get the current url of my app in various components, I don't want to derive this value from my routing component as that may be removed / changed in time. So I wish to work with the <code>Location</code> class in Angular2. In my component I add the following...</p>
  
  <pre><code>import {Location} from '@angular/common';
  </code></pre>
  
  <p>in my component I declare this in my constructor...</p>
  
  <pre><code>constructor(public translate:TranslateService, router:Router, private location: Location) 
  </code></pre>
  
  <p>Now when I try to work with this I notice the error in my console... <code>browser_adapter.ts:82 ORIGINAL EXCEPTION: No provider for Location!</code></p>
  
  <p>The location class is located in <code>@angular/common</code>? I can't see how I have made a mistake here? I am using Angular2 release candidate 4. Here's what my code looks like altogether, I have edited this to make it less overwhelming:</p>
  
  <pre><code>import {Location} from '@angular/common';
  
  @Component({
      selector: 'my-app',
      directives: [ ],
      pipes: [ ],
      templateUrl: 'src/main.html'
  })
  class MyComponent {
  
      constructor( private location: Location) {
          console.log(location);
      }
  }
  </code></pre>