title: Can't resolve all parameters for GlobalsService: (?)
body: <p>I'm trying to use a service to store information that is globally used. At the moment it should just contain the current user.</p>
  
  <pre><code>import {Injectable} from '@angular/core';
  import {UserService} from "../user/user.service";
  
  import {User} from "../user/user";
  
  @Injectable()
  export class GlobalsService {
      private currentUser: User = null;      
  
      constructor(private userService: UserService) {
          this.userService.getCurrentUser().subscribe(user =&gt; this.currentUser = user);
      }
  }
  </code></pre>
  
  <p>This is my <code>app.module.ts</code>:</p>
  
  <pre><code>import {NgModule} from "@angular/core";
  import {BrowserModule} from '@angular/platform-browser';
  import {HttpModule} from '@angular/http';
  import {routing} from "./app.routing";
  
  import {AppComponent} from './app.component';
  import {UserModule} from "./user/user.module";
  
  import {CanActivateViaOAuthGuard} from "./auth/oAuth.canActivateGuard";
  
  import {GlobalsService} from './globals/globals.service';
  
  
  @NgModule({
      imports: [BrowserModule, HttpModule, routing, UserModule],
      declarations: [AppComponent],
      bootstrap: [AppComponent],
      providers: [GlobalsService, CanActivateViaOAuthGuard]
  })
  
  export class AppModule {
  }
  </code></pre>
  
  <p>Now I get this error:</p>
  
  <pre><code>Unhandled Promise rejection: (SystemJS) Can't resolve all parameters for GlobalsService: (?).
      Error: Can't resolve all parameters for GlobalsService: (?).
          at CompileMetadataResolver.getDependenciesMetadata 
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The UserService is provided by the <code>user.module.ts</code> :</p>
  
  <pre><code>import {NgModule} from "@angular/core";
  import {UserComponent} from "./user.component";
  import {CommonModule} from "@angular/common";
  import {UserService} from './user.service';
  
  @NgModule({
      providers:[UserService],
      imports: [CommonModule],
      declarations: [UserComponent],
      exports: [UserComponent]
  })
  
  export class UserModule{}
  </code></pre>
  
  <p>If I remove the <code>UserService</code> from the constructor of <code>GlobalsService</code> the error disappears.</p>
  
  <p>The UserService:</p>
  
  <pre><code>import {Injectable} from '@angular/core';
  
  import {AuthHttp} from "../auth/authHttp.service";
  import {Observable} from "rxjs";
  import {User} from "./user";
  import {GlobalsService} from "../globals/globals.service";
  
  @Injectable()
  export class UserService {
      private url: string = this.globals.getServerUrl() + 'users';
  
      constructor(private http: AuthHttp, private globals: GlobalsService) {
      }
  
      getUsers(): Observable&lt;User[]&gt; {
          return this.http.get(this.url);
      }
  
      getCurrentUser(): Observable&lt;User&gt; {
          return this.http.get(this.url + '/me');
      }
  }
  </code></pre>