core: Using TranslateService in a provider is not working
I’m submitting a … (check one with “x”)
[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request
Current behavior Does not find the TranslateService…
Reproduction of the problem
Add a provider, import TranslateService and add it to the constructor… says “The name “TranslateService” cannot be found.”
What is the expected behavior?
Please tell us about your environment:
cordova CLI: 6.5.0
Ionic Framework Version: 2.1.0-201703061537
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24
Calling
getTranslation
beforeget
resolves the issue.Make sure to use
service.use ('nl');
somewhere at the start of you application. Then you will get the correct values.One thing that might be the reason why you think it’s not working is because the result is not an array but an object with key-value pairs.
Try the following things, what does this output?
Thanks was Visual Studio… still got a problem.
Can you get the translation data. save it and then use it later? Because this way I just get the name of the values and not the values itself 😕
private translationLet: any;
@AlexanderKozhevin
This works for me, I have called
getTranslation
before calling get method: