anchor.diff:  <a id="toc"></a>
   :marked
     ## Table of contents
  +  
     ## 目录
   
     [Application-wide dependencies](#app-wide-dependencies)
  
positive.code:     to its parent injector, where the process repeats until there are no more injectors. 
      If the search is futile, the injector throws an error ... unless the request was [optional](#optional).
      
      如果注入器对请求的令牌没有一个对应的供应商，它便将这个请求交给它父级的注入器，这个过程反复从夫，知道没有更多注入器位置。
      如果搜索无用，注入器便抛出一个错误...除非这个请求是[optional](#optional)。
      
      Let's return our attention to providers themselves.
      让我们把注意力转回到供应商。
  :marked
    A new injector has no providers.
    
    一个新的注入器没有供应商。
    Angular initializes the injectors it creates with some providers it cares about.
    We have to register our _own_ application providers manually, 
    usually in the `providers` array of the `Component` or `Directive` metadata:
    
    Angular初始化一些他自己建立和需要的注入器，附带一些供应商。我们必须要亲自手动注册属于_自己_的供应商，通常在`组件`或者`指令`的元数据里面的`providers`数组（里面注册）。
  +makeExample('cb-dependency-injection/ts/app/app.component.ts','providers','app/app.component.ts (providers)') 
  :marked
    ### Defining providers
    ### 定义供应商
    
    The simple class provider is the most typical by far.
    We mention the class in the `providers` array and we're done.
    
    目前一个简单的类供应商是最典型的例子。
    我们在`providers`的数值里面提到该类就行了。
  +makeExample('cb-dependency-injection/ts/app/hero-bios.component.ts','class-provider','app/hero-bios.component.ts (class provider)')(format='.') 
  :marked
    It's that simple because the most common injected service is an instance of a class.
    But not every dependency can be satisfied by creating a new instance of a class.
    We need other ways to deliver dependency values and that means we need other ways to specify a provider.
    
    这就是那么简单，因为最常见的被注入的服务是一个类的实例。但是，不是所有的依赖能在能建立一个类的新实例就够了的。我们需要其它的提交依赖值得方法，也就是说我们需要其它方法来指定一个供应商。
    
    The `HeroOfTheMonthComponent` example demonstrates many of the alternatives and why we need them. 
    
    `HeroOfTheMonthComponent`例子示范了一些备择方案，揭示了为什么我们需要它们。
  figure.image-display
    img(src="/resources/images/cookbooks/dependency-injection/hero-of-month.png" alt="Hero of the month" width="300px")
  :marked
    It's visually simple: a few properties and the output of a logger. The code behind it gives us plenty to talk about.
    
    它看起来很简单：一些属性和一个日志output。但是后面的代码给我们很多议论点。
  +makeExample('cb-dependency-injection/ts/app/hero-of-the-month.component.ts','hero-of-the-month','hero-of-the-month.component.ts')   
  
  .l-main-section
  a(id='provide')
  :marked
    #### The *provide* function
    #### *provide*函数
    
    The imported Angular `provide` function creates an instance of 
  
negative.code:     Defining *Alex* and *Cathy* in separate files won't help. 
      *Alex* would have to import *Cathy* and *Cathy* would have to import *Alex*.
      
      在单独的文件里面定义*Alex*和*Cathy*没有作用。*Alex*必须要导入*Cathy*，*Cathy*必须要导入*Alex*。
      
      We *had* to define *Alex* first because, 
      while we can add `forwardRef(CathyComponent)` to *Alex*'s `directives` array,
      we can't write `public alex: forwardRef(AlexComponent))` in *Cathy*'s constructor. 
      
      我们*被迫*先定义*Alex*，因为我们可以添加`forwardRef(CathyComponent)`到*Alex*的`Directives`数组里面，但是我们不能在*Cathy*的构造函数里面使用`public alex: forwardRef(AlexComponent))`。
      
  :marked
    We face a similar dilemma when a class makes *a reference to itself*
    as does the `AlexComponent` in its `providers` array. 
  