title: Angular2 error - No provider error for my login component
body: <p>No provider error with Angular2.</p>
  
  <p><strong>Exact error message from browser console: "EXCEPTION: No provider for User! (Login -> User)".</strong></p>
  
  <p>The typescript compiler compiles fine.</p>
  
  <p>The template loads fine.</p>
  
  <p>But the browser console has that error.</p>
  
  <p>Also, can you check if my template is correct with the click and ng-model.</p>
  
  <p><strong>This is my code:</strong></p>
  
  <pre><code> import {Component, View, Injectable, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';
   import {AuthService} from '../../authService';
  
   @Injectable()
   class User{
      email:string;
      password: string;
   } 
  
   @Component({
     selector: 'Login',  
   })
  
   @View({
     templateUrl: '/src/app/components/login/login.html',
     directives: [CORE_DIRECTIVES, FORM_DIRECTIVES],
   })
  
   @Injectable()
   export class Login {
     authService:AuthService;
     user: User;
  
     constructor(authService: AuthService, user: User){   
         this.authService = authService;
         this.user = user;
     }
  
     login = () =&gt; {
        console.log("login");
     }
   }
  enter code here
  </code></pre>
  
  <p><strong>This is my template for this component:</strong></p>
  
  <pre><code>  &lt;section class="container centered"&gt;
        &lt;div class="row"&gt;
            &lt;div class="well bs-component col-xs-12 col-xs-offset-0 col-sm-12 col-sm-offset-0 col-md-6 col-md-offset-3 col-lg-offset-4 col-lg-4"&gt;
                &lt;h3&gt;Log In&lt;/h3&gt;
  
              &lt;form class="padding-top-20" role="form" novalidate&gt; 
                    &lt;div class="form-group"&gt;
                        &lt;input class="form-control" type="text" name="email" id="email" placeholder="Email Address" [(ng-model)]="user.userName" required autofocus /&gt;
                    &lt;/div&gt;
  
                    &lt;div class="form-group"&gt;
                        &lt;input class="form-control" type="password" name="password" id="password" placeholder="Password" [(ng-model)]="user.password" required autofocus /&gt;
                    &lt;/div&gt;
  
                    &lt;button class="btn btn-primary btn-wide" type="submit" (click)="login()"&gt;Log In&lt;/button&gt;
  
                    &lt;div class="padding-top-20 padding-bottom-20"&gt;
                        &lt;a href="/forgotpassword" title="Forgot Password?"&gt;Forgot Password?&lt;/a&gt;
                    &lt;/div&gt;
                &lt;/form&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/section&gt;
  </code></pre>
  
  <p>Here is a screenshot of the browser console error:</p>
  
  <p><a href="https://i.stack.imgur.com/38aco.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/38aco.png" alt="enter image description here"></a></p>