title: Angular2 - when both services requires each other
body: <p>This is my main component (the root component). Here I declare some services which are supposed to be accessible through whole application.</p>
  
  <pre><code>@Component({
      ...
      providers: [
        WebSocketService,
        ...
        AuthenticationService,
      ]
  })
  export class MainComponent { ... }
  </code></pre>
  
  <p>And - to be sure that evrybody understand - I'm doing:</p>
  
  <pre><code>bootstrap(MainComponent, [...]);
  </code></pre>
  
  <p>Both of WebSocketService and AuthenticationService are annotated with <code>@Injectable()</code>. Everything worked fine until I found that both services requires each other.
  AuthenticationService needs WebSocketService to communicate with backend server and WebSocketService needs AuthenticationService to check whether user is logged etc.</p>
  
  <p>As a result I'm receiving that error message:</p>
  
  <blockquote>
    <p>EXCEPTION: Cannot resolve all parameters for
    'AuthenticationService'(undefined). Make sure that all the parameters
    are decorated with Inject or have valid type annotations and that
    'AuthenticationService' is decorated with Injectable.</p>
  </blockquote>
  
  <p>Here is the fragment of AuthenticationService. WebSocketService looks similiar.</p>
  
  <pre><code>@Injectable()
  export class AuthenticationService implements OnInit {
  
      constructor(private webSocketService:WebSocketService) {
      }
      ...
  }
  </code></pre>
  
  <p>I know, that there are different and maybe better solutions for this case (third service, etc) but this is not the point of my question.
  I would like to know if there is a way to inject two services into each other with Angular2 in similiar way that I had presented?</p>