title: Service instance is not available for child component in angular2
body: <p>I have created some services which should be shared within whole application but for some reason child components are throwing error
  <code>Error: DI Exception at NoProviderError.BaseException [as constructor]</code>
  I have provided all the services inside boot file</p>
  
  <pre><code>bootstrap(AppComponent, [
      JwtHelper,
      HTTP_PROVIDERS, authervice, ROUTER_PROVIDERS, 
      categoryService,
      Configuration
  ]);
  </code></pre>
  
  <p>can anyone suggest something? if you need more explanation or code let me know.</p>
  
  <p>category component</p>
  
  <pre><code>import ...
  import {categoryService}       from './categoryService';
  @Component({
      selector: 'category-list',
      template: `...`,
      directives: [],
      styles: ['.error {color:red;}'],
      providers: []
  
  })
  export class categoryComponent implements OnInit {
      constructor(private _categoryService: categoryService) { }
      ...
  }
  </code></pre>
  
  <p>If i add categoryservice in providers above it works otherwise throws error</p>
  
  <p>complete error</p>
  
  <blockquote>
    <p>EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in :0:0
    ORIGINAL EXCEPTION: No provider for categoryService! ORIGINAL
    STACKTRACE: Error: DI Exception
        at NoProviderError.BaseException [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23" rel="nofollow">http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23</a>)
        at NoProviderError.AbstractProviderError [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16</a>)
        at new NoProviderError (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16</a>)
        at ReflectiveInjector_._throwOrNull (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25</a>)
        at ReflectiveInjector_._getByKey (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25</a>)
        at ReflectiveInjector_.get (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24</a>)
    ERROR CONTEXT: [object Object] zone.js:461 Unhandled Promise
    rejection: EXCEPTION: Error in :0:0 ORIGINAL EXCEPTION: No provider
    for categoryService! ORIGINAL STACKTRACE: Error: DI Exception
        at NoProviderError.BaseException [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23" rel="nofollow">http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23</a>)
        at NoProviderError.AbstractProviderError [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16</a>)
        at new NoProviderError (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16</a>)
        at ReflectiveInjector_._throwOrNull (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25</a>)
        at ReflectiveInjector_._getByKey (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25</a>)
        at ReflectiveInjector_.get (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24</a>)
    ERROR CONTEXT: [object Object] ; Zone: angular ; Task: Promise.then ;
    Value: ViewWrappedException {_wrapperMessage: "Error in :0:0",
    _originalException: NoProviderError, _originalStack: "Error: DI Exception↵    at
    NoProviderError.BaseExc…ngular/core/src/di/reflective_injector.js:801:24)",
    _context: DebugContext, _wrapperStack: "Error: Error in :0:0↵    at ViewWrappedException.W…localhost:58056/libs/zone.js/dist/zone.js:322:35)"}consoleError
    @ zone.js:461_loop_1 @ zone.js:490drainMicroTaskQueue @
    zone.js:494ZoneTask.invoke @ zone.js:426 zone.js:463 Error: Uncaught
    (in promise): EXCEPTION: Error in :0:0 ORIGINAL EXCEPTION: No provider
    for categoryService! ORIGINAL STACKTRACE: Error: DI Exception
        at NoProviderError.BaseException [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23" rel="nofollow">http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23</a>)
        at NoProviderError.AbstractProviderError [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16</a>)
        at new NoProviderError (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16</a>)
        at ReflectiveInjector_._throwOrNull (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25</a>)
        at ReflectiveInjector_._getByKey (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25</a>)
        at ReflectiveInjector_.get (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24</a>)
    ERROR CONTEXT: [object Object]
        at NoProviderError.BaseException [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23" rel="nofollow">http://localhost:58056/libs/@angular/core/src/facade/exceptions.js:17:23</a>)
        at NoProviderError.AbstractProviderError [as constructor] (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:39:16</a>)
        at new NoProviderError (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_exceptions.js:75:16</a>)
        at ReflectiveInjector_._throwOrNull (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:776:19</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:804:25</a>)
        at ReflectiveInjector_._getByKey (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:767:25</a>)
        at ReflectiveInjector_.get (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:576:21</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ElementInjector.get (<a href="http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48" rel="nofollow">http://localhost:58056/libs/@angular/core/src/linker/element_injector.js:23:48</a>)
        at ReflectiveInjector_._getByKeyDefault (<a href="http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24" rel="nofollow">http://localhost:58056/libs/@angular/core/src/di/reflective_injector.js:801:24</a>)
    ERROR CONTEXT: [object Object]
        at resolvePromise (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:538:32" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:538:32</a>)
        at <a href="http://localhost:58056/libs/zone.js/dist/zone.js:574:18" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:574:18</a>
        at ZoneDelegate.invokeTask (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:356:38" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:356:38</a>)
        at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (<a href="http://localhost:58056/libs/@angular/core/src/zone/ng_zone_impl.js:36:41" rel="nofollow">http://localhost:58056/libs/@angular/core/src/zone/ng_zone_impl.js:36:41</a>)
        at ZoneDelegate.invokeTask (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:355:43" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:355:43</a>)
        at Zone.runTask (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:256:48" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:256:48</a>)
        at drainMicroTaskQueue (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:474:36" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:474:36</a>)
        at XMLHttpRequest.ZoneTask.invoke (<a href="http://localhost:58056/libs/zone.js/dist/zone.js:426:22)consoleError" rel="nofollow">http://localhost:58056/libs/zone.js/dist/zone.js:426:22)consoleError</a>
    @ zone.js:463_loop_1 @ zone.js:490drainMicroTaskQueue @
    zone.js:494ZoneTask.invoke @ zone.js:426</p>
  </blockquote>