title: Angular 6 Service is undefined after injecting in Interceptor
body: <p>I can't find any way to inject my <strong><em>AuthService</em></strong> inside <strong><em>ErrorHandlerInterceptor</em></strong>.
  It returns me either an "<em>undefined</em>" object after injection, or it throws an error.</p>
  
  <p>This is my <strong><em>ErrorHandlerInterceptor</em></strong>:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { AuthService } from '@app/auth.service';
  import { StorageService } from '@app/storage.service';
  
  @Injectable({
    providedIn: 'root'
  })
  export class ErrorHandlerInterceptor implements HttpInterceptor {
  
    constructor(private authService: AuthService, private storageService: StorageService) {
      console.log(this.authService); // undefined
    }
  
    intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      return next.handle(request).pipe(catchError(error =&gt; this.errorHandler(error)));
    }
  
    // Customize the default error handler here if needed
    private errorHandler(response: HttpErrorResponse): Observable&lt;HttpEvent&lt;any&gt;&gt; 
    {
      // ... Various code
    }
  }
  </code></pre>
  
  <p>And this is my <strong><em>AuthService</em></strong>:</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  import { StorageService } from './storage.service';
  import { Router } from '@angular/router';
  
  @Injectable({
      providedIn: 'root'
  })
  export class AuthService {
      constructor(private _http: HttpClient, 
      private storageService: StorageService, 
      private router: Router) { }
  }
  </code></pre>
  
  <p>I tried to list the service  in the <code>core.module.ts</code> providers, but errors are thrown:</p>
  
  <pre><code>ERROR RangeError: Maximum call stack size exceeded
  at setCurrentInjector (core.js:1382)
  at resolveNgModuleDep (core.js:8333)
  at _createClass (core.js:8425)
  at _createProviderInstance (core.js:8393)
  at resolveNgModuleDep (core.js:8356)
  at _createClass (core.js:8425)
  at _createProviderInstance (core.js:8393)
  at resolveNgModuleDep (core.js:8356)
  at _createClass (core.js:8425)
  at _createProviderInstance (core.js:8393)
  </code></pre>
  
  <p>Note that I am using the framework <code>ngx-rocket</code>, created by <code>ngx-rocket-generator</code>.</p>
  
  <p>How can I do to fix this issue? Any advices?</p>
  
  <hr>
  
  <p><strong>UPDATE 1 -- CORE.MODULE.TS</strong></p>
  
  <p>Here is the core.module.ts file.</p>
  
  <pre><code>import { NgModule, Optional, SkipSelf } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http';
  import { RouteReuseStrategy, RouterModule } from '@angular/router';
  import { TranslateModule } from '@ngx-translate/core';
  import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
  
  import { ShellComponent } from './shell/shell.component';
  import { HeaderComponent } from './shell/header/header.component';
  import { RouteReusableStrategy } from './route-reusable-strategy';
  import { AuthenticationService } from './authentication/authentication.service';
  import { AuthenticationGuard } from './authentication/authentication.guard';
  import { I18nService } from './i18n.service';
  import { HttpService } from './http/http.service';
  import { HttpCacheService } from './http/http-cache.service';
  import { ApiPrefixInterceptor } from './http/api-prefix.interceptor';
  import { ErrorHandlerInterceptor } from './http/error-handler.interceptor';
  import { CacheInterceptor } from './http/cache.interceptor';
  import { TokenInterceptor } from './http/token.interceptor';
  import { StorageService } from '@app/storage.service';
  import { AuthService } from '@app/auth.service';
  
  @NgModule({
    imports: [
      CommonModule,
      HttpClientModule,
      TranslateModule,
      NgbModule,
      RouterModule
    ],
    declarations: [
      HeaderComponent,
      ShellComponent
    ],
    providers: [
      AuthenticationService,
      AuthenticationGuard,
      I18nService,
      HttpCacheService,
      ApiPrefixInterceptor,
      ErrorHandlerInterceptor,
      CacheInterceptor,
      TokenInterceptor,
      {
        provide: HttpClient,
        useClass: HttpService
      },
      {
        provide: RouteReuseStrategy,
        useClass: RouteReusableStrategy
      }
    ]
  })
  export class CoreModule {
  
    constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
      // Import guard
      if (parentModule) {
        throw new Error(`${parentModule} has already been loaded. Import Core module in the AppModule only.`);
      }
    }
  
  }
  </code></pre>