No provider for ConnectionBackend

Angular

Angular Problem Overview


So recently I had to update to the latest version of Angular2, RC.6. The biggest breaking change seems to be the whole bootstrapping (by "introducing" ngModule).

@NgModule({
    imports: [HttpModule, BrowserModule, FormsModule],
    schemas: [CUSTOM_ELEMENTS_SCHEMA],
    declarations: [AppComponent, ...],
    providers: [FrameService, Http, { provide: $WINDOW,  useValue: window }],
    bootstrap: [AppComponent]
})
class AppModule {

}

platformBrowserDynamic().bootstrapModule(AppModule);

However after a lot of tears, sweat and pleading to all the deities I could come up with... I still remain with what is hopefully the last error in a series of many:

No provider for ConnectionBackend!

At this point I am tearing out the last strains of hair I have left as I am clueless at this point regarding the "what I am missing".

Kind regards!

Angular Solutions


Solution 1 - Angular

Http is redundant in

providers: [FrameService, Http, { provide: $WINDOW,  useValue: window }],

because HttpModule in

imports: [HttpModule, BrowserModule, FormsModule],

provides it already.

Solution 2 - Angular

In app.module.ts add:

import { HttpModule } from '@angular/http';

And import module:

imports: [
    ...
    HttpModule
    ...
  ],

Solution 3 - Angular

I removed 'Http' from this import like this and it worked for me. Also, BrowserModule must come before HttpModule in the modume imports.

Before:

import { HttpModule, Http } from '@angular/http';

After:

import { HttpModule } from '@angular/http';

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionXabreView Question on Stackoverflow
Solution 1 - AngularGünter ZöchbauerView Answer on Stackoverflow
Solution 2 - AngularMilton QuirinoView Answer on Stackoverflow
Solution 3 - AngularElawry kipView Answer on Stackoverflow