'Supplied parameters do not match any signature of call target - angular 4
I'm using ngx-translate
in service. Exactly in this function.
@Injectable()
export class StartService {
constructor(private translateService: TranslateService) { }
load(): Promise<any> {
return this.http
.get(this.context + 'health', null, true)
.map(res => {
const response = res.json() as InvioTelematicoBaseModel
if (response != null && response.error != null && response.error.esito === 0) {
////////
} else {
this.http.restUpAndRunning = false;
this.esitoSectionService.setErrorMessage(this.translateService.instant('IMPOSSIBILE_CONTATTARE_I_SERVIZI_REST')); // here I'm using this.translateService.instant
}
})
.toPromise()
.catch((err: any) => {
this.http.restUpAndRunning = false;
Promise.resolve()
});
}
}
When I added this.translateService.instant('IMPOSSIBILE_CONTATTARE_I_SERVIZI_REST')
inside this.esitoSectionService.setErrorMessage()
I get this error
> [at-loader] Checking finished with 1 errors
> [at-loader] ./compiled/src/app/app.module.ngfactory.ts:286:31 TS2346: Supplied
> parameters do not match any signature of call target.
Have you any idea please, how to use ngx-translate
in this case?
This is function serErrorMessage:
setErrorMessage(message: string) {
const baseRestResponse = new InvioModel();
baseRestResponse.error = new ErrorModel();
baseRestResponse.error.esito = 99
baseRestResponse.error.error = message;
this.baseRestResponse.next(baseRestResponse);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|