title: Providers and Modules childs
body: <p>I do not undestand why i need set a provider in an parent component if anyway i will import it later in a child component as a service. </p>
  
  <p>This is the service:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  
  @Injectable()
  export class AService {
   doSomething(){
      return 'i am a service';
   }
  }
  </code></pre>
  
  <p>This is the parent:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { AService }  from './a-service';
  import { ChildComponent }  from './child.component';
  
  @Component({
    selector: 'my-parent',
    directives: [ChildComponent],
    providers:[AService],
    template:'&lt;my-child&gt;&lt;/my-child&gt;'
  })
  
  export class ParentComponent{ }
  </code></pre>
  
  <p>The angular2 documentation says: <a href="https://angular.io/docs/ts/latest/guide/dependency-injection.html#!#registering-providers-in-a-component" rel="nofollow">link here</a></p>
  
  <blockquote>
    <p>Look closely at the providers part of the @Component metadata. An instance of the HeroService is now available for injection in this HeroesComponent and all of its child components.</p>
  </blockquote>
  
  <p>But, in the definition of the child component, i need import the service anyway. If I dont, it will crash:</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { AService }  from './a-service';
  
  @Component({
    selector: 'my-child',
    template:'&lt;p&gt; this is the {{service_returned_data}}'
  })
  
  export class ChildComponent{ 
    constructor(private _service: AService){}
    service_returned_data=_service.doSomething();
  }
  </code></pre>
  
  <p>Can anybody explain me the meaning of this?</p>