-
-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please define another method for Instant string retrieval #20
Comments
Yes, I can code that, but you have to be aware that if your translations haven't been loaded then "instant" would return the key (or undefined). |
I am aware of that... that's why I'm trying to load my translation config part in @app constructor, and the translate.instant would I the call in @page controllers/constructor/functions. But... wouldn't something like this be enough to make this work?
|
👍 for this, I'm using ng2-translate in an Ionic app and often I need to get a translation for some services that expect to have a string and not an observable. |
FYI, I created my own class to do this:
|
Nice thanks! |
This has been added in 1.8.0 ! |
awesome thanks |
angular-translate had such a good method which you could use in JS (not in templates) without getting a Promise back.
$translate.instant('key') would then return you your value of key in lang file.
where as current translate (from ng2-translate) always returns observable. There are few parts in my code, where I would just want to call translate.instant(key) without making a long .subscribe(data =>... part.
Could that kind of function be also implemented in ng2-translate?
Thank you for your work!
👍
The text was updated successfully, but these errors were encountered: