title: How to access Angular2 root injected Service in Component?
body: <p>According to <a href="http://victorsavkin.com/post/126514197956/dependency-injection-in-angular-1-and-angular-2" rel="nofollow">http://victorsavkin.com/post/126514197956/dependency-injection-in-angular-1-and-angular-2</a>, application-wide services can be added to the root injector using something like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>bootstrap(App, [UserService, LoginService]</code></pre>
  </div>
  </div>
  </p>
  
  <p>And then can be accessed in child components like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class A {
    constructor(userService: UserService) {
      
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>However, an exception results, complaining the parameters can't be resolved and suggesting to make sure they have proper type or annotation.</p>
  
  <p>What is the right way to inject application-wide services and access them in child components?</p>