So I am in the process of upgrading my app to angular 4, I guess this is a library related issue? I used to import from @angular/http earlier. Now, I use @angular/common/http. Do I need to separately include more libraries for this to work? What am I missing here?
I get the following error:
core.es5.js:1020 ERROR Error: Uncaught (in promise): Error: No provider for Http!
Error: No provider for Http!
My app.module.ts file
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { HttpClientModule, HttpClient } from '@angular/common/http';
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module';
import { LayoutModule } from './layout/layout.module';
import { SharedModule } from './shared/shared.module';
import { RoutesModule } from './routes/routes.module';
import { Angular2TokenService } from 'angular2-token';
export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
@NgModule({
declarations: [
AppComponent
],
imports: [
HttpClientModule,
BrowserAnimationsModule,
CoreModule,
LayoutModule,
SharedModule.forRoot(),
RoutesModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
})
],
providers: [
Angular2TokenService
],
bootstrap: [AppComponent]
})
export class AppModule { }
So I am in the process of upgrading my app to angular 4, I guess this is a library related issue? I used to import from @angular/http earlier. Now, I use @angular/common/http. Do I need to separately include more libraries for this to work? What am I missing here?
I get the following error:
My app.module.ts file
My file.component.ts
My package.json