Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for ConnectionBackend

Tags:

angular

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!

like image 739
Xabre Avatar asked Sep 08 '16 14:09

Xabre


2 Answers

Http is redundant in

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

because HttpModule in

imports: [HttpModule, BrowserModule, FormsModule],

provides it already.

like image 139
Günter Zöchbauer Avatar answered Nov 04 '22 11:11

Günter Zöchbauer


In app.module.ts add:

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

And import module:

imports: [
    ...
    HttpModule
    ...
  ],
like image 20
Milton Quirino Avatar answered Nov 04 '22 13:11

Milton Quirino