-
Notifications
You must be signed in to change notification settings - Fork 59
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
Translation inside feature modules #50
Comments
If you are using lazy loaded modules with the router, there are two scenarios:
You must not call the
You must call the
But you have to reinitialize |
Thanks for the quick response. I have been trying to do the first option you mentionted and I don't seem to get it to work. I have moved the modules to my CoreModule and have created a HomeModule for my HomeComponent. This should allow it to use any services from the CoreModule, right? This is my CoreModule:
My AppComponent is the same. So, shouldn't |
Sorry, but I don't understand what you are trying to do. However: for the first option, in the
so you create the new instances of the services. In all the other sub-modules, you have to use:
and remove from the
otherwise you create other instances. |
Neither do I, lol! Anyway, I've been doing it wrong, thanks for your help, everything is clear to me now and it works. I just couldn't comprehend how it all works I guess. Thanks a lot for the help! |
You'll never know until you try... :) |
@Shiroh1ge I'm closing this issue. If you need, open a new issue. Greetings |
So I'm trying to make the translation to work globally, but I don't seem to get how it works. It might be my lack of understanding of how modules/services in Angular 2 work. Following the guide here I have the following setup right now:
And my AppComponent:
And then in my CoursesComponent, I have set it as the guide for Lazy routing:
The translation works in my HomeComponent, but not in my CoursesComponent. What's weird is that if I import LocalizationModule only and not LocalizationModule.forChild(), translation works. Does that mean that it is creating an instance for the first time and the instance created from AppModule is not injected inside CoursesModule? Do I need to export the service through the CoreModule? I'm confused, any help is appreciated!
The text was updated successfully, but these errors were encountered: