NetanelBasal / transloco-with-nx-libs

inline loaders

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using selectTranslate with scope is not working in component ts file when translation files are placed in library

BVSureshBabu opened this issue · comments

Hi,

I am trying to use translocoService.selectTranslate in component but it is not working if I place translation files in library. I used below syntax in location-a.component.ts file. Please help me on the same.

this.translocoService.selectTranslate('cc.gpsa',{},'en').subscribe(result => {
  console.log("Translation is   ",result);
})

Thanks,
Suresh Babu

Hi,

Using below syntax I am able to translate in component.

constructor(private translocoService: TranslocoService, @Inject(TRANSLOCO_SCOPE) private scope) {}

ngOnInit() {

this.translocoService.selectTranslate('gpsa',{},this.scope).subscribe(result => {
  console.log("Translation is   ",result);
})

}

Thanks,
Suresh