title: Injecting services into services in angular2
body: <p>I want to write some kind of Broadcast mechanism to dynamically create and use <code>EventEmitter</code>s in my user context. To do so I inject the an <code>EmitterService</code></p>
  
  <pre><code>@Injectable()
  export class BroadcastService implements OnInit {
      private _emitters: { [channel: string]: EventEmitter&lt;any&gt; } = {};    
      constructor() {}    
      get(channel: string): EventEmitter&lt;any&gt; {
          if (!this._emitters[channel]) { 
              this._emitters[channel] = new EventEmitter();
          }
          return this._emitters[channel];
      }    
      ngOnInit() { }    
  }
  </code></pre>
  
  <p>My components structure looks like this:</p>
  
  <pre><code>                [root]
                   |  |
             [comp-a][comp-b]
  </code></pre>
  
  <p>In my <code>root</code> component I inject the <code>BroadcastService</code> to make sure every sub-component uses the same Broadcast Channels. In addition other services like an <code>AuthService</code> are injected (in the <code>root</code> too, that's basically my user context)</p>
  
  <pre><code>@Component({
      provider: [BroadcastService, AuthService]
  })
  </code></pre>
  
  <p>The <code>AuthService</code> (and others) are using the <code>BroadcastService</code> for emit events:</p>
  
  <pre><code>@Injectable()
  export class AuthService extends BaseService {      
  constructor(
          http: Http,
          @Inject(BroadcastService) private emitterService: BroadcastService)
      {              
          super(http);                 
      }
      ...
      // Example usage of Broadcast
      login(username: string, password: string) {
          // do the login, when successfully:
          this.emitterService.get("online").emit(true);
      }
  }
  </code></pre>
  
  <p>The error I get:
  <code>EXCEPTION: Cannot resolve all parameters for 'AuthService'(Http, undefined @Inject(undefined)). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'AuthService' is decorated with Injectable.</code></p>
  
  <p>What I tried:</p>
  
  <ol>
  <li>Putting another root component on top the the current root component to inject the <code>BroadcastService</code> there, same result</li>
  <li>Adding/Removing the @Inject to the constructor parameter, no changes</li>
  <li>Begging and crying, didn't help</li>
  </ol>
  
  <p>The strangest part is, that this works with one of my other services and doesn't with the rest of them (well, I didn't try all, but those I tried didn't work). Do you have any clues what the problem could be? Or is this maybe just a bug (I'm using angular2 in 2.0.0-beta.2)</p>