i'm using angular-cli as a client for Jhipster, and when i try to build my project i have a probleme on Translate module, i tried to upgrade to ngx-translate but i still having the same problem.
here is the error i got :
'TranslateService' is not assignable to parameter of type 'TranslateService'.
shared-common.module.ts :
import { NgModule, Sanitizer } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { TranslateService } from 'ng2-translate';
import { AlertService } from 'ng-jhipster';
import {
CarcheckappSharedLibsModule,
JhiLanguageHelper,
FindLanguageFromKeyPipe,
JhiAlertComponent,
JhiAlertErrorComponent
} from './';
export function alertServiceProvider(sanitizer: Sanitizer,
translateService: TranslateService) {
// set below to true to make alerts look like toast
const isToast = false;
return new AlertService(sanitizer, isToast, translateService);
}
@NgModule({
imports: [
CarcheckappSharedLibsModule
],
declarations: [
FindLanguageFromKeyPipe,
JhiAlertComponent,
JhiAlertErrorComponent
],
providers: [
JhiLanguageHelper,
{
provide: AlertService,
useFactory: alertServiceProvider,
deps: [Sanitizer, TranslateService]
},
Title
],
exports: [
CarcheckappSharedLibsModule,
FindLanguageFromKeyPipe,
JhiAlertComponent,
JhiAlertErrorComponent
]
})
export class CarcheckappSharedCommonModule {}
You are using the wrong package.
import { TranslateService} from '@ngx-translate/core';
The AlertService
expects TranslateService
from @ngx-translate/core
, you cannot swap it with another one.
If you want to use ng2-translate
you have to create your own AlertService
.