Skip to content
Advertisement

Angular 12 ngx-translate / loader isn’t working

https://www.npmjs.com/package/@ngx-translate/core https://www.npmjs.com/package/@ngx-translate/http-loader I installed translate package from here and added ngx-translate module with its forRoot , translate service inside component ts (app & header) but it isn’t working also

Header component

JavaScript

Header.component.ts

JavaScript

app.module.ts

JavaScript

I also tried same steps in app.component.ts

JavaScript

Advertisement

Answer

The pipe syntax is {{ 'my-translation-key' | translate }} – you have double || in your template, please change and try again.

Alternatively you can inject the translate service and use myTanslation = this.translateService.instant('my-translation-key') if you need to set a variable in your controller.

Advertisement