I want to set global setting for ng-select, the "notFoundText" as translated value by ngx-translate TranslateService:
export class AppComponent {
constructor(
public translate: TranslateService,
private readonly ngSelectConfig: NgSelectConfig
) {
translate.addLangs(['pl-PL']);
translate.setDefaultLang('pl-PL');
this.ngSelectConfig.notFoundText =
this.translate.instant('GENERAL.NO_DATA');
}
}
In this implementation, translate.instant() returns "GENERAL.NO_DATA" instead of translated text. It works in several places (also in several modules, so generally my configuration works), but it does not work in root component. 'GENERAL.NO_DATA' also exists in my JSON file, because i'm using it for a long time.
How can I use TranslateService in this component?