Angular2 - 'Can't resolve all parameters' error while injecting http into a custom service
<p>I have built an <strong>ErrorHandlerLogger</strong> which is a service which extends ErrorHandler and logs error messages into a remote repository.</p>

<p><strong>ErrorHandlerLogger</strong> requires the Angular <strong>http</strong> client provided by the <strong>HttpModule</strong>.</p>

<p>In the <strong>ErrorHandlerModule</strong> I import <strong>HttpModule</strong> and define <strong>ErrorHandlerLogger</strong> as provider.</p>

<p>In the <strong>AppModule</strong> I import <strong>ErrorHandlerModule</strong>.</p>

<p>When I launch the app I get the following error message</p>

<pre><code>Uncaught Error: Can't resolve all parameters for ErrorHandlerLogger: (?).
</code></pre>

<p>Here my code</p>

<p><strong>ErrorHandlerModule</strong></p>

<pre><code>import { NgModule, ErrorHandler } from '@angular/core';
import { HttpModule } from '@angular/http';

import {ErrorHandlerLogger} from './error-handler-logger';

@NgModule({
    declarations: [],
    exports: [],
    imports: [
        HttpModule
    ],
    providers: [
        {provide: ErrorHandler, useClass: ErrorHandlerLogger}
    ]
})
export class ErrorHandlerModule {}
</code></pre>

<p><strong>ErrorHandlerLogger</strong></p>

<pre><code>import { ErrorHandler } from '@angular/core';
import { Http, Headers, RequestOptions, Response } from '@angular/http';
import { Observable }     from 'rxjs/Observable';
import './rxjs-operators';

export class ErrorHandlerLogger extends ErrorHandler {
    constructor(private http: Http) {
        super();
     }

    handleError(error) {
        // my logic
    }

}
</code></pre>

<p><strong>AppModule</strong></p>

<pre><code>import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {ErrorHandlerModule} from './error-manager/error-handler.module';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    routing,
    ErrorHandlerModule
  ],
  providers: [appRoutingProviders],
  bootstrap: [AppComponent]
})
export class AppModule { }
</code></pre>

<p>Any help is very much appreciated</p>