1

I'm using ng2-translate with angular2 and it's working really well. The point is I just updated angular to RC4 yesterday and I have a problem with the ng2-translate module I guess.

I have this error:

Unhandled Promise rejection: Error: Invalid provider - only instances of Provider and Type are allowed, got: [object Object]

Here is my main.ts:

// On injecte les services dont on aura besoin partout ici comme ça nous réutilisons la même instance
bootstrap(GuichetAppComponent, [
    guichetAppRouterProviders,
    CefEventDispatcherService,
    CefService,
    LoggerService, 
    TimerService,
    Renderer,
    HTTP_PROVIDERS,
    {
        provide: TranslateLoader,
        useFactory: (http: Http) => new TranslateStaticLoader(http, 'app/assets/i18n', '.json'),
        deps: [Http]
    },
    TranslateService,
    CurrentVMService,
    LangueService,
    BoutonActionService,
    CompteService,
    InfosGuichetService
]).catch((err: any) => console.log(err));

If i remove the provide section and translateservice it's working fine.

Thanks guys.

Julien Moreau
  • 151
  • 1
  • 4
  • 16

1 Answers1

0

I expirienced similer bug with rc 4... when using npm install it seems like the latest ng2 translate version installed no matter what version is specified in the package.json file. I solved it by deleting the new version and manually copying the old version to node_modules folder and setting the old version in the package file.

Yan.F
  • 630
  • 5
  • 20