anchor.diff:    Any capabilities that you would have put in a pipe and shared across the app can be
     written in a filtering/sorting service and injected into the component.
   
  +  Angular开发组和一些有经验的Angular开发者强烈建议你：把你的过滤和排序逻辑挪进组件本身。
  +  组件可以对外暴露一个`filteredHeroes`或`sortedHeroes`属性，这样它就获得控制权，以决定要用什么频度去执行其它辅助逻辑。
  +  你原本准备实现为管道，并在整个应用中共享的那些功能，都能被改写为一个过滤/排序的服务，并注入到组件中。
  +
     If these performance and minification considerations do not apply to you, you can always create your own such pipes
     (along the lines of the [FlyingHeroesPipe](#impure-flying-heroes)) or find them in the community.
  +
  +  如果你不需要顾虑这些性能和最小化问题，也可以创建自己的管道来实现这些功能(参考[FlyingHeroesPipe](#impure-flying-heroes)中的写法)或到社区中去找找。
  
positive.code:   Remember that impure pipes are called every few microseconds.
    If we're not careful, this pipe will punish the server with requests.
  
    We are careful. Our pipe only makes a server call if the request URL has changed.
    It caches the request URL and waits for a result which it also caches when it arrives.
    The pipe returns the cached result (which is null while a request is in flight)
    after every Angular call and only contacts the server as necessary.
  
    Here's the code, which uses the [Angular http](server-communication.html) facility
    to retrieve a `heroes.json` file:
  
  +makeExample('pipes/ts/app/fetch-json.pipe.ts', null, 'app/fetch-json.pipe.ts')
  :marked
    Then we demonstrate it in a harness component whose template defines two bindings to this pipe.
  +makeExample('pipes/ts/app/hero-list.component.ts', 'template', 'app/hero-list.component.ts (template)')
  :marked
    Despite the two bindings and what we know to be frequent pipe calls,
    the nework tab in the browser developer tools confirms that there is only one request for the file.
  
    The component renders like this:
  
  figure.image-display
      img(src='/resources/images/devguide/pipes/hero-list.png' alt="Hero List")
  
negative.code:   We take the same fetched results displayed in the first binding
    and display them again, this time in JSON format by chaining through to the built-in `JsonPipe`.
  
    第二个绑定除了用到`FetchPipe`之外还链接了更多管道。
    我们把获取数据的结果同时显示在第一个绑定和第二个绑定中。第二个绑定中，我们通过链接到一个内建管道`JsonPipe`把它转成了JSON格式。
  
  .callout.is-helpful
    header Debugging with the json pipe
    header 借助json管道进行调试
    :marked
      The [JsonPipe](../api/common/JsonPipe-class.html)
      provides an easy way to diagnosis a mysteriously failing data binding or
      inspect an object for future binding.
  
      [JsonPipe](../api/common/JsonPipe-class.html)为你诊断数据绑定的某些神秘错误或为做进一步绑定而探查数据时，提供了一个简单途径。
  
  :marked
    Here's the complete component implementation:
  
    下面是组件完整的实现代码：
  
  +makeExample('pipes/ts/app/hero-list.component.ts', null, 'app/hero-list.component.ts')
  
  a(id="pure-pipe-pure-fn")
  :marked
    ### Pure pipes and pure functions
    ### 纯管道与纯函数
  
    A pure pipe uses pure functions.
    Pure functions process inputs and return values without detectable side-effects.
    Given the same input they should always return the same output.
  
    纯管道使用纯函数。
    纯函数是指在处理输入并返回结果时，不会产生任何副作用的函数。
    给定相同的输入，它们总是返回相同的输出。
  
    The pipes we saw earlier in this chapter were implemented with pure functions.
    The built-in `DatePipe` is a pure pipe with a pure function implementation.
  