anchor.diff:    But it only works when Angular injects the component with the service instance in the test's root injector.
     Fortunately, in this test suite, the _only_ provider of `UserService` is the root testing module, 
     so it is safe to call `TestBed.get` as follows:
  +
  +  你**可以**通过`TestBed.get`方法来从根注入器中获取服务。
  +  它更容易被记住，也更加简介。
  +  But it only works when Angular injects the component with the service instance in the test's root injector.
  +  Fortunately, in this test suite, the _only_ provider of `UserService` is the root testing module, 
  +  so it is safe to call `TestBed.get` as follows:
  +  
   +makeExample('testing/ts/app/welcome.component.spec.ts', 'inject-from-testbed', 'TestBed injector')(format='.')
   .l-sub-section
     :marked
  
positive.code:   The safest way to get the injected service, the way that **_always works_**, 
    is to **get it from the injector of the _component-under-test_**.
    The component injector is a property of the fixture's `DebugElement`.
  +makeExample('testing/ts/app/welcome.component.spec.ts', 'injected-service', 'WelcomeComponent\'s injector')(format='.')
  
  #testbed-get
  :marked
    ### _TestBed.get_
  
    You _may_ also be able to get the service from the root injector via `TestBed.get`.
  
negative.code:   1. [Introduction to Angular Testing](#testing-intro)
  
    1. [Angular测试入门](#testing-intro)
    <br>
  
    1. [Setup](#setup)
  
    1. [搭建测试环境](#setup)
  
      - [setup files](#setup-files): `karma.conf`, `karma-test-shim`, `systemjs.config`    
  
      - [文件配置](#setup-files): `karma.conf`, `karma-test-shim`, `systemjs.config`  
  
      - [npm packages](#npm-packages)
  
      - [npm 包](#npm-packages)
      
    1. [The first karma test](#1st-karma-test)
  
    1. [第一个Karma测试](#1st-karma-test)  
    <br>
    
    1. [Introduction to the Angular testing utilities](#atu-intro)
  
    1. [Angular测试工具](#atu-intro)  
    <br>  
  
    1. [The sample application and its tests](#sample-app)
  
    1. [例子应用及其测试](#sample-app)  
    <br>
  
    1. [A simple component test](#simple-component-test)
  
    1. [一个简单的组件测试](#simple-component-test) 
  
      - [_configureTestingModule_](#configure-testing-module)
  
      - [_configureTestingModule_](#configure-testing-module)
  
      - [_createComponent_](#create-component)
  
      - [_createComponent_](#create-component)
  
      - [_ComponentFixture_, _DebugElement_, _query(By.css)_](#component-fixture)
  
      - [_ComponentFixture_, _DebugElement_, _query(By.css)_](#component-fixture)
  
      - [_detectChanges_](#detect-changes)
  
      - [_detectChanges_](#detect-changes)
  
      - [_autoDetectChanges_](#auto-detect-changes)
  
      - [_autoDetectChanges_](#auto-detect-changes)
  
    1. [Test a component with a service dependency](#component-with-dependency)
  
    1. [测试拥有服务依赖的组件](#component-with-dependency)
  
      - [test doubles](#service-test-doubles)
  
      - [测试复制品](#service-test-doubles)
  
      - [get the injected service](#get-injected-service)
  
      - [获取注入的服务](#get-injected-service)
  
      - [_TestBed.get_](#testbed-get)
  
      - [_TestBed.get_](#testbed-get)
  
    1. [Test a component with an async service](#component-with-async-service)  
  
    1. [测试拥有异步服务的组件](#component-with-async-service)  
  
      - [spies](#service-spy)
  
      - [spies](#service-spy)
  
      - [_async_](#async)
  
      - [_async_](#async)
  
      - [_whenStable_](#when-stable)
  
      - [_whenStable_](#when-stable)
  
      - [_fakeAsync_](#async)
  
      - [_fakeAsync_](#async)
  
      - [_tick_](#tick)
  
      - [_tick_](#tick)
  
      - [_jasmine.done_](#jasmine-done)
  
      - [_jasmine.done_](#jasmine-done)
  
    1. [Test a component with an external template](#component-with-external-template)
  
    1. [测试拥有外部模板的组件](#component-with-external-template)   
  
      - [_async_](#async-in-before-each) in `beforeEach`
  
      - [_async_](#async-in-before-each) in `beforeEach`
  
      - [_compileComponents_](#compile-components)
  
      - [_compileComponents_](#compile-components)
  
    1. [Test a component with inputs and outputs](#component-with-inputs-output)
  
    1. [测试拥有导入（inputs）和导出（outputs）的组件](#component-with-inputs-output)  
  
      - [_triggerEventHandler_](#trigger-event-handler)
  
      - [_triggerEventHandler_](#trigger-event-handler)
  
    1. [Test a component inside a test host component](#component-inside-test-host)
  
    1. [在宿主组件中测试组件](#component-inside-test-host)
    <br>
  
    1. [Test a routed component](#routed-component)
  
    1. [测试路由组件](#routed-component)  
    
      - [_inject_](#inject)
  
      - [_inject_](#inject)
  
    1. [Test a routed component with parameters](#routed-component-w-param)
  
    1. [测试一个带有参数的被路由的组件](#routed-component-w-param)  
  
      - [_Observable_ test double](#stub-observable)
  
      - [**可观察**测试复制品](#stub-observable)
  
    1. [Use a _page_ object to simplify setup](#page-object)
  
    1. [使用**page**对象来简化配置](#page-object)
    <br>
  
    1. [Setup with module imports](#import-module)
  
    1. [用模块的导入进行配置](#import-module)
    <br>
  
    1. [Override component providers](#component-override)
  
    1. [替换组件提供商](#component-override)
    <br>
  
    1. [Test a _RouterOutlet_ component](#router-outlet-component)
  
    1. [测试一个**RouterOutlet**组件](#router-outlet-component)
  
      - [stubbing unneeded components](#stub-component)
  
      - [伪造不需要的组件](#stub-component)
  
      - [Stubbing the _RouterLink_](#router-link-stub)
  
      - [伪造_RouterLink_](#router-link-stub)
  
      - [_By.directive_ and injected directives](#by-directive)
  
      - [_By.directive_和注入的指令](#by-directive)
  
    1. ["Shallow" component tests with  *NO\_ERRORS\_SCHEMA*](#shallow-component-test)
  
    1. [使用*NO\_ERRORS\_SCHEMA*来“浅化”组件测试](#shallow-component-test)
    <br>
  
    1. [Test an attribute directive](#attribute-directive)
  
    1. [测试属性指令](#attribute-directive)
    <br>
  
    1. [Isolated unit tests](#isolated-unit-tests "Unit testing without the Angular testing utilities")
  
    1. [隔离的单元测试](#isolated-unit-tests "Unit testing without the Angular testing utilities")
  
      - [服务](#isolated-service-tests)
  
      - [管道](#isolated-pipe-tests)
  
      - [组件](#isolated-component-tests)
  
    1. [Angular testing utility APIs](#atu-apis)
  
    1. [Angular测试工具APIs](#atu-apis)
  
      - [Stand-alone functions](#atu-apis): `async`, `fakeAsync`, etc.
  
      - [独立函数](#atu-apis): `async`, `fakeAsync`, etc.
  
      - [_TestBed_](#testbed-class-summary)
  
      - [_TestBed_](#testbed-class-summary)
  
      - [_ComponentFixture_](#component-fixture-class-summary)
  
      - [_ComponentFixture_](#component-fixture-class-summary)
  
      - [_DebugElement_](#debug-element-details)
  
      - [_DebugElement_](#debug-element-details)  
  
    1. [FAQ](#faq "Frequently asked questions")  
  
    1. [常见问题](#faq "Frequently asked questions")
  :marked
    It’s a big agenda. Fortunately, you can learn a little bit at a time and put each lesson to use.
  