Reputation: 1320
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!
Upvotes: 55
Views: 33044
Reputation: 11
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';
Upvotes: -1
Reputation: 658017
Http
is redundant in
providers: [FrameService, Http, { provide: $WINDOW, useValue: window }],
because HttpModule
in
imports: [HttpModule, BrowserModule, FormsModule],
provides it already.
Upvotes: 101
Reputation: 108
In app.module.ts add:
import { HttpModule } from '@angular/http';
And import module:
imports: [
...
HttpModule
...
],
Upvotes: 2