title: Angular 8 not able to get Injector when test
body: <p>I create one sample project in <a href="https://stackblitz.com/edit/angular-bdquuj" rel="nofollow noreferrer">stackblitz</a> here. The sample project has 2 components(TestComponent and Test1Component), 1 service(TestService) and 1 class(Base) which TestComponent will extend.</p>
  
  <p>There is one use case that i need to get service instance without using constructor, i am using below code and it works fine. </p>
  
  <p>AppModule:</p>
  
  <pre><code>@NgModule({
    imports:      [ BrowserModule, FormsModule,],
    declarations: [ AppComponent,  TestComponent, Test1Component ],
    bootstrap:    [ AppComponent ],
    exports: [TestComponent, Test1Component]
  })
  export class AppModule {
    static injector: Injector;
    constructor(injector: Injector) {
      AppModule.injector = injector;
    }
  }
  </code></pre>
  
  <p>And then in Base.ts.</p>
  
  <pre><code>export class Base {
    constructor() {
      console.log("i am base");
      let service = AppModule.injector.get(TestService); // with this i can get test service succesfully
    }
  }
  </code></pre>
  
  <p>When I try to write test case for TestComponent, error throws, see below code, i don't know why this happen, please help... thanks.</p>
  
  <pre><code>describe("TestComponent", () =&gt; {
    // throws error, Error during loading: Uncaught ReferenceError: Cannot access 'TestComponent' before initialization
    let component: TestComponent;
    let fixture: ComponentFixture&lt;TestComponent&gt;;
  
    beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
        imports: [AppModule]
      }).compileComponents();
      fixture = TestBed.createComponent(TestComponent); 
      component = fixture.componentInstance;
      fixture.detectChanges();
    }));
  
    it("should create", () =&gt; {
      expect(component).toBeTruthy();
    });
  });
  </code></pre>
  
  <p>My env:</p>
  
  <pre><code>Angular CLI: 8.3.14
  Node: 10.16.0
  OS: darwin x64
  Angular: 8.2.12
  ... animations, common, compiler, compiler-cli, core, forms
  ... language-service, platform-browser, platform-browser-dynamic
  ... router
  
  Package                           Version
  -----------------------------------------------------------
  @angular-devkit/architect         0.803.14
  @angular-devkit/build-angular     0.803.14
  @angular-devkit/build-optimizer   0.803.14
  @angular-devkit/build-webpack     0.803.14
  @angular-devkit/core              8.3.14
  @angular-devkit/schematics        8.3.14
  @angular/cdk                      8.2.3
  @angular/cli                      8.3.14
  @angular/material                 8.2.3
  @ngtools/webpack                  8.3.14
  @schematics/angular               8.3.14
  @schematics/update                0.803.14
  rxjs                              6.4.0
  typescript                        3.5.3
  webpack                           4.39.2
  </code></pre>