ngx-translate/http-loader

Can't resolve all parameters for TranslateHttpLoader

devdaddy opened this issue · 3 comments

When compiling my code with ionic/cordova I keep getting the error once the Angular Compiler has started:

Can't resolve all parameters for TranslateHttpLoader in 
           /<project-root>/node_modules/@ngx-translate/http-loader/src/http-loader.d.ts:
            ([object Object], ?, ?). 

ng -v info:

Angular CLI: 1.7.3
Node: 8.9.3
OS: darwin x64
Angular: 5.0.0
... compiler, compiler-cli, core, forms, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular/common: 5.2.8
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.4.2
webpack: 3.11.0

UPDATE:
Here is the app.module.ts

import { Injectable, Injector, NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { HttpModule, Http, RequestOptions } from '@angular/http';
import { HttpClient, HttpClientModule } from "@angular/common/http";
import { TranslateModule, TranslateLoader } from "@ngx-translate/core";
import { TranslateHttpLoader } from "@ngx-translate/http-loader";

import { IEPortal } from './app.component';

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './../assets/i18n/', '.json');
}
 
@NgModule({
  declarations: [
    HomePage
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [ HttpClient ]
      }
    })
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    HomePage
  ],
  providers: [
    { provide: ErrorHandler, useClass: EdgeError },
  HttpClient
  ]
})
export class AppModule {}

I will take any suggestions at this point.

Also, I must have typescript >= 2.4.2 < 2.5.0 for several of my other plugins.

@devdaddy what is the version of ngx-translate?
Why are you importing 2 libraries of Angular HTTP?

I will answer your second question first. I was importing, but not using the Angular Http v <4.3, just hadn't removed it yet when I posted this.

I am using ngx-translate v9.1.1.

However this can be resolved as I solved this by updating @angular/common to version 5.2.8 and the compiler AoT compiler error went away.

@devdaddy you solved? I have the miss problem