http-loader
http-loader copied to clipboard
HttpClient
Would be nice for people that have updated to use the new HttpClient in @angular/common/http to have a separate loader here that uses it instead of Http.
Was thinking the same thing, realized my httploader will no longer work
for 1.0.0 http-loader start to using Angular 4.3 HttpClientModule. so in app.module.ts import { HttpClient, HttpClientModule } from "@angular/common/http"; export function createTranslateLoader(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); }
@NgModule({ imports: [ ... HttpClientModule ... TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] }, missingTranslationHandler: {provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler}, useDefaultLang: false, }),
This should be solved by now with #14 PR.
Tried using it on ionic 2:
Typescript Error Cannot find module '@angular/common/http'.
in node_modules/@ngx-translate/http-loader/src/http-loader.d.ts import { HttpClient } from "@angular/common/http";
You should use
import { HttpClient, HttpClientModule } from '@angular/common/http';
I'm having also the same problem as @PunkHaz4rd using ionic
Typescript Error
Cannot find module '@angular/common/http'.
node_modules/@ngx-translate/http-loader/src/http-loader.d.ts
@PunkHaz4rd did you find a way to get it to work?
@Murazaki Sorry, but i didn't understand what you want us to do.
Where should i import it?
I tried to import it on the app.module.ts
but i get an error:
Cannot find module '@angular/common/http'.
@rodrigoreal yes I changed for ng2-translate
@angular/common/http
is only available in angular 4.3+.
For prior versions, you should use ngx-translate/[email protected].