How to use instant with ngx-translate

2.9k views Asked by At

I'm using ngx-translate with Angular 4 and I have a problem when I change the language. It works for statics values in HTML but not strings in services.

The documentation says :

instant(key: string|Array, interpolateParams?: Object): string|Object: Gets the instant translated value of a key (or an array of keys). /!\ This method is synchronous and the default file loader is asynchronous. You are responsible for knowing when your translations have been loaded and it is safe to use this method. If you are not sure then you should use the get method instead.

I have no idea how to use it. When I try "translate.instant" in my service, I get the key but not the value.

Can I get more explanations about how to use instant ?

0

There are 0 answers