anchor.diff:      .file typings.json
   :marked
     Here are the code files we discussed in this chapter.
  +  
  +  这就是我们在本章讨论过的这些源码文件：
   
   +makeTabs(`
     toh-4/ts/app/hero.service.ts,
  
positive.code:   `)
  :marked
    ## The Road We’ve Travelled
    Let’s take stock of what we’ve built.
  
    * We created a service class that can be shared by many components
    * We used the `ngOnInit` Lifecycle Hook to get our heroes when our `AppComponent` activates
    * We defined our `HeroService` as a provider for our `AppComponent`
    * We created mock hero data and imported them into our service
    * We designed our service to return a promise and our component to get our data from the promise
  
    [Run the live example for part 4](/resources/live-examples/toh-4/ts/plnkr.html)
  
    ### The Road Ahead
    Our Tour of Heroes has become more reusable using shared components and services.
    We want to create a dashboard, add menu links that route between the views, and format data in a template.
    As our app evolves, we’ll learn how to design it to make it easier to grow and maintain.
    
    We learn about Angular Component Router and navigation among the views in the [next tutorial](toh-pt5.html) chapter.
    
  .l-main-section
  <a id="slow"></a>
  :marked
    ### Appendix: Take it slow
    
    We can simulate a slow connection.
    
    Import the `Hero` symbol and add the following `getHeroesSlowly` method to the `HeroService`
  +makeExample('toh-4/ts/app/hero.service.ts', 'get-heroes-slowly', 'hero.service.ts (getHeroesSlowy)')(format=".")
  :marked
    Like `getHeroes`, it also returns a promise. 
    But this promise waits 2 seconds before resolving the promise with mock heroes.
    
    Back in the `AppComponent`, replace `_heroService.getHeroes` with `_heroService.getHeroesSlowly`
    and see how the app behaves.
    
  .l-main-section
  <a id="shadow-provider"></a>
  :marked
    ### Appendix: Shadowing the parent's service
    
    We stated [earlier](#child-component) that if we injected the parent `AppComponent` `HeroService`
    into the `HeroDetailComponent`, *we must not add a providers array* to the `HeroDetailComponent` metadata.
  
    Why?  Because that tells Angular to create a new instance of the `HeroService` at the `HeroDetailComponent` level.
    The `HeroDetailComponent` doesn't want its *own*  service instance; it wants its *parent's* service instance.
    Adding the `providers` array creates a new service instance that shadows the parent instance.
    
    Think carefully about where and when to register a provider. 
    Understand the scope of that registration. Be careful not to create a new service instance at the wrong level.
  
negative.code:   Because data services are invariably asynchronous, 
    we'll finish the chapter with a promise-based version of the data service.
  
    因为数据服务通常都是异步的，所以在本章的最后，我们会把它重构为基于承诺（Promise，一种异步编程模式）的版本。
  :marked
    [Run the live example for part 4](/resources/live-examples/toh-4/ts/plnkr.html)
    
  