Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Can't resolve all parameters for TranslateHttpLoader #43

Closed
devdaddy opened this issue Mar 12, 2018 · 3 comments
Closed

Can't resolve all parameters for TranslateHttpLoader #43

devdaddy opened this issue Mar 12, 2018 · 3 comments

Comments

@devdaddy
Copy link

devdaddy commented Mar 12, 2018

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.

@tiaguinho
Copy link
Member

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

@devdaddy
Copy link
Author

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.

@ceaguilera
Copy link

@devdaddy you solved? I have the miss problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants